what is the out put of below queries?
a. select * from Emp where null = null;
b. select * from Emp where 1=1;

Answers were Sorted based on User's Feedback



what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / phani

In First case it will not return any rows. only the colum
names will be displayed.

In the second case all the records that are available in
the table will be displayed.

Is This Answer Correct ?    61 Yes 1 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / jay vardhan singh

select * from Emp where null = null;

null can not be equal to null.So,Condition is not satisfied.
So,it will give only column name.

select * from Emp where 1=1;

1 is always equal to 1.So,Condition is satisfied ,So It
will give all data which is present in table.

Is This Answer Correct ?    23 Yes 1 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / subbu

1st Query Output is:

SQL> select * from Emp where null = null;

no rows selected

2nd Query Output is:

All the rows and columns of emp table

Is This Answer Correct ?    19 Yes 1 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / jerry joseph

a. select * from Emp where null = null;

null = null will be always false.. so no rows returned..
change the query to "select * from Emp where null is null;"
to select all rows

b. select * from Emp where 1=1;

1 = 1 will be always true.. so all the rows are returned..

Is This Answer Correct ?    17 Yes 1 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / anil patel

a. select * from Emp where null = null;

null= null is always false os no rows returns.

b. select * from Emp where 1=1;

it returns all rows

Is This Answer Correct ?    9 Yes 0 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / gowthami radhakrishnan

a)in the first case there is no output only the column
names alone is displyed

b)in this case all rows will be displayed even for
1=1,2=2,3=3,..........

Is This Answer Correct ?    5 Yes 0 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / radhakrishnan

a) first statement return only table structure (with out
data)
Eg: empid empname

b) second statement return the structure with data.

Eg: empid empname
101 radha
102 krishnan

Is This Answer Correct ?    3 Yes 0 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / sailaja

Hi,

select * from EMP where null=null;
->null=null is always false so it gives 0 records.
if it is null is null then it fetches all the records in a
table..

select * from EMP where 1=1;
->it fetches all the records in a table
if it is select * from EMP where 1=2;
-->it fetches 0 records..

Is This Answer Correct ?    1 Yes 1 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / m@ngesh

in the first query There is no records to show in output
box only show the column name Like empname, city, address
etc..
and the second query say that there is all records are to
be show.when query (1=1) will be satisfied on the table

Is This Answer Correct ?    1 Yes 1 No

what is the out put of below queries? a. select * from Emp where null = null; b. select * ..

Answer / nitin yadav(9229430059)

A. Will give you no record because null have no value that
means no comparision between two nulls.

B.will give all row because 1=1 condision always true for
all rows.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

1. What are the grouping function in SQL ? 2. If base table of a view deleted means, what will happen while we querying on view ? will give any error ? 3. Difference between DROP, DELETE, TRUNCATE table ? 4. What is constraints and types ? 5. What is max size of nchar & nvarchar ? 6. Define ROLLBACK, COMMIT, SAVE POINT 7. How non-clustered better ? or rank the Clustered, Non-Clustered and Table scan in performance wise 8. Select 10 rows from a table ? 9. Define DML, DDL, DCL, DTL commands ? 10. What is mean by NULL value ? NULL means "" or 0 or undefined ? 11. Default constraints ? 12. Can we have more then primary Key in table ? 13. Type of integrity ? Entity, Referential, Domain ?

10 Answers   Perot Systems,


Why SQL Agent is used?

0 Answers   Abacus,


You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?

0 Answers  


How can windows applications connect to sql servers via odbc?

0 Answers  


What are the different index configurations a table can have?

0 Answers  






How do you troubleshoot errors in a SQL Server Agent Job?

0 Answers  


What is join query?

0 Answers  


Can two tables share a primary key?

0 Answers  


what is database replicaion? : Sql server database administration

0 Answers  


Does sql server 2016 have ssms?

0 Answers  


explain query execution plan

1 Answers  


Do you know what are the restrictions that views have to follow?

0 Answers  


Categories