Hi friends,

I think the MySql is not case sensitive for selecting values. for example I am having a table called dept,

Id | Depart

1 | BTECH
11 | it
12 | ibt
2 | BE
21 | cse
22 | ece

Now i want to select the capital dept values from dept, but not using the id. how can i achieve it. I tried the following as query ..
select upper(depart) from dept;
but its just converting all values of dept table to capital. that is
it shows as follows
BTECH
IT
IBT
BE
CSE
ECE.
So how can i filter the lower case values to just display the upper case values to look like the following result

Depart

BTECH
BE

please help me if u know the solution.

Recommended Answers

All 4 Replies

try this

CONCAT( UPPER( SUBSTRING( colname, 1, 1 ) ) , LOWER( SUBSTRING( colname, 2 ) ) )

This will also work select * from table1 where (depart COLLATE latin1_bin )=Upper(depart)

try this

CONCAT( UPPER( SUBSTRING( colname, 1, 1 ) ) , LOWER( SUBSTRING( colname, 2 ) ) )

Hello R0bb0b,

Your query doesn't works for me.

This will also work select * from table1 where (depart COLLATE latin1_bin )=Upper(depart)

Hello varmadba,

Thanks for giving your query, its works for me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.