Hi all,
what is the output of select * from emp where null=null & select * from emp where 1=1?
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kiran NakhalePosted Aug 16, 2010, 2:35 AM
Hi,
First Query will result nothing and second query would return all values of table since 1=1 is true
Thanks,
Kiran
ShambhuPosted Aug 15, 2010, 2:40 PM
if u will set ANSI_NULLS OFF and try this
set ansi_nulls off
select * from emp where null=null
It will give all records from the table
but if you will set ANSI_NULLS on and execute like
set ansi_nulls on
select * from emp where null=null
no record will be displayed.
and
select * from emp where 1=1 also will give all records.
Regards,
Shambhu
Deepak PandeyPosted Jun 13, 2010, 1:06 AM
does not display any records from the emp table .
and ur second query i.e. "select * from emp where 1=1"
will display all records from the emp table since the where conditions will always be true for all the records.
Satyapriya NayakPosted Jun 12, 2010, 10:08 AM
Thanks
Daniel VarghesePosted Jun 12, 2010, 6:40 AM
Both the select queries will return all the records from the emp table since the where conditions will always be true for all the records.
Thanks,
Daniel