Re: MySQLdb compare lower

Discussion in 'Python' started by Dennis Lee Bieber, Dec 12, 2012.

  1. 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
    operation:

    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://wlfraed.home.netcom.com/
     
    Dennis Lee Bieber, Dec 12, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anatoli Hristov

    MySQLdb compare lower

    Anatoli Hristov, Dec 11, 2012, in forum: Python
    Replies:
    2
    Views:
    131
    Anatoli Hristov
    Dec 11, 2012
  2. Cameron Simpson

    Re: MySQLdb compare lower

    Cameron Simpson, Dec 11, 2012, in forum: Python
    Replies:
    0
    Views:
    146
    Cameron Simpson
    Dec 11, 2012
  3. Cameron Simpson

    Re: MySQLdb compare lower

    Cameron Simpson, Dec 13, 2012, in forum: Python
    Replies:
    0
    Views:
    149
    Cameron Simpson
    Dec 13, 2012
  4. Dennis Lee Bieber

    Re: MySQLdb compare lower

    Dennis Lee Bieber, Dec 13, 2012, in forum: Python
    Replies:
    0
    Views:
    144
    Dennis Lee Bieber
    Dec 13, 2012
  5. Cameron Simpson

    Re: MySQLdb compare lower

    Cameron Simpson, Dec 14, 2012, in forum: Python
    Replies:
    0
    Views:
    135
    Cameron Simpson
    Dec 14, 2012
Loading...

Share This Page