case in-sensitive sql query



case in-sensitive sql query

Postby raghuvanshi » Tue Nov 06, 2012 7:33 pm

In the interview test one of the questions was asked in which I have doubt is below-:

If a table has a VARCHAR columns, containing values: prod,system,PROD,Test,Prod. Which one of the following queries will find all the records containing 'PROD' irrespective of the case?

a) SELECT * FROM TABLE WHERE COLUMN=IGNORE_CASE('PROD')
b) SELECT * FROM TABLE WHERE COLUMN=LOWER_CASE('prod')
c) SELECT * FROM TABLE WHERE LCASE(COLUMN)='prod'
d.) None of these
My answer was a)
raghuvanshi
 
Posts: 43
Joined: Tue Dec 07, 2010 5:32 pm
Has thanked: 3 times
Been thanked: 0 time

Re: case in-sensitive sql query

 

Re: case in-sensitive sql query

Postby raghuvanshi » Wed Nov 07, 2012 8:06 pm

Hi,

Any suggestions are welcome.
raghuvanshi
 
Posts: 43
Joined: Tue Dec 07, 2010 5:32 pm
Has thanked: 3 times
Been thanked: 0 time

Re: case in-sensitive sql query

Postby BillyBoyo » Wed Nov 07, 2012 8:15 pm

With the benefit of the time that has elapsed, what have you discovered by looking in the manuals?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: case in-sensitive sql query

Postby raghuvanshi » Thu Nov 08, 2012 12:11 pm

C is the correct answer
raghuvanshi
 
Posts: 43
Joined: Tue Dec 07, 2010 5:32 pm
Has thanked: 3 times
Been thanked: 0 time

Re: case in-sensitive sql query

Postby BillyBoyo » Thu Nov 08, 2012 3:19 pm

That's nice and definitive. Can you provide a link to the manual reference that you found, it can help other people looking at the same type of thing in the future?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: case in-sensitive sql query

Postby raghuvanshi » Thu Nov 08, 2012 8:33 pm

raghuvanshi
 
Posts: 43
Joined: Tue Dec 07, 2010 5:32 pm
Has thanked: 3 times
Been thanked: 0 time


Return to Interview Questions

 


  • Related topics
    Replies
    Views
    Last post