Reputation: 165
How can we check In PostgreSQL or SQL:
A string saved in database to lowercase OR uppercase?
For example, I have five records in my database table and I want to fetch only those records that have lowercase characters.
Here is my content table and id's in primary key
id Content
1 TEST
2 Test
3 TEst
4 TESt
5 TEST01
I need to fetch id 2,3,4 respectively which contains context value in lowercase.
Upvotes: 0
Views: 1181
Reputation: 246268
Add the following WHERE
clause:
WHERE content <> upper(content)
That will only retrieve the rows that contain lower case characters.
Upvotes: 3