Velocity Reviews

Velocity Reviews (
-   Python (
-   -   Re: MySQLdb compare lower (

Dennis Lee Bieber 12-12-2012 07:03 AM

Re: MySQLdb compare lower
On Tue, 11 Dec 2012 22:01:18 +0100, Anatoli Hristov <>
declaimed the following in gmane.comp.python.general:

> Hello guys,
> Excuse me for the noob question, but is there a way to compare a field
> in mysql as lower() somehow?
> I have a situation where I compare the SKU in my DB and there are some
> SKU that are with lowercase and some with uppercase, how can I solve
> this in your opinion ?

According to the old "MySQL Language Reference"

By default, string comparisons are not case sensitive and will use the
current character set (ISO-8859-1 Latin1 by default, which also works
excellently for English).

I suppose one may encounter a MySQL database where the system
default has been configured to be case sensitive

The other option might be to run a (hopefully) one-time update

update theTable set SKU = LOWER(SKU);

and then ensure that any user input is forced to lowercase before it
gets into the database.
Wulfraed Dennis Lee Bieber AF6VN HTTP://

All times are GMT. The time now is 03:17 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.