简体   繁体   中英

Is database record is case sensitive?

I have two tables City and CityCommunity in City table one column contain cityName like this

cityName = 'ABC'

And in CityCommunity table we have same column cityName but value of this columnName is something like this

 cityName = 'abc' 

Will it effect in query when we will run a Join query. In my case when I am joining these two table in the above case when both cityName same but only difference is case sensitive will it effect query to run

By default it is not case sensitive. So it will treat 'ABC' and 'abc' as same. But to make it case sensitive you have to use COLLATE. You can find the detailed explanation with example HERE . This applys to join also.

In Oracle Yes, the results are case sensitive so if you are looking for cityName = 'ABC' the results with cityName = 'abc' or cityName ='Abc' won't show!

You need to add UPPER so you can get all results

SELECT UPPER(cityName)
FROM City;

in this case, no matter what case are the results it will convert the whole column data to upper case

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM