Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '"""': 0.05; 'suppose': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'language': 0.14; 'dec': 0.15; 'guys,': 0.16; 'lowercase': 0.16; 'operation:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:compare': 0.16; 'string': 0.17; 'input': 0.18; 'default,': 0.22; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; '+0100,': 0.29; 'character': 0.29; 'gets': 0.32; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'compare': 0.36; 'charset:us-ascii': 0.36; 'option': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'situation': 0.62; 'solve': 0.62; 'english).': 0.84; 'forced': 0.84; 'dennis': 0.91; 'received:108': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: MySQLdb compare lower Date: Wed, 12 Dec 2012 02:03:48 -0500 Organization: > Bestiaria Support Staff < References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-220-160.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355295822 news.xs4all.nl 6967 [2001:888:2000:d::a6]:35211 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34689 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 wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/