I was give thie query:
Code: Select all
select * from emp where 1=1
Code: Select all
select * from emp where one=one
I replied the answer will be same...but they said I'm wrong. Can someone please help me with the answer.
Code: Select all
select * from emp where 1=1
Code: Select all
select * from emp where one=one
shh..hhh many of us had been interviewers!enrico-sorichetti wrote:What's the difference between a dead dog and a dead interviewer on a road?
The skid marks in front of the dog. ...
Thanks for the answers. After reading about the explanation on "one" makes me feel that why it did not strike meAnuj Dhawan wrote:The second query will not work. "one" on the left side of the = will be treated as the COLUMN name by the DB2 and it'll fail indicating column not found, as "one" is not a part of the table. You should get SQLCODE=-206, typically. If there is a column named "one" in the table, the question would not make much sense to me.
1=1 will not fail from a technical point of view, however, it has got its own debate of being useful or not but I think talking about that is not needed in the context of this interview question.
I had the same reactions after coming out of the interview...enrico-sorichetti wrote:too many interview questions force to reword the dog/lawyer joke
What's the difference between a dead dog and a dead interviewer on a road?
The skid marks in front of the dog. ...
You need to be a member in order to post a reply
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute