Re: Selecting all records which are in upper case

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Amitabh Kant <amitabhkant(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Selecting all records which are in upper case
Date: 2011-08-27 10:10:18
Message-ID: 20110827101017.GA12352@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Aug 27, 2011 at 03:12:44PM +0530, Amitabh Kant wrote:
> Hello
>
> I have a simple table 'location' :
> id -> Int (associated with a sequence)
> name -> Character varying (100)
>
> I have to delete all records where values in name field are all in upper
> case. For example, if the test data is as follows:

Might not work if you have non-ascii characters (but your example code
breaks there too), but what about:

DELETE ... WHERE upper(name) = name;

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.
-- Arthur Schopenhauer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message José María Terry Jiménez 2011-08-27 10:15:52 Re: Performing upgrade to latest minor release using PGDG RPMs
Previous Message Amitabh Kant 2011-08-27 09:42:44 Selecting all records which are in upper case