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
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
if we have a column (Key) in a table. and values of that column is Key 1 1 1 2 2 3 3 4 4 5 5 5 and we want to show the data after query..like.. 1(3) 2(3) 3(2) 4(2) 5(3) how many times a single term comes..
17 Answers 3i Infotech, Rolta, TCS,
What is the maximum length of an alert name?
How to grant a permission in ms sql server using "grant execute" statements?
Is port 1433 secure?
hi... this is charan.I persued btech in 2010 looking for a job on database/back-end as freehser. can any seggest me which course or back-end tool i have to learn
you are provided with the single table having say 4 col ie fname lname age city , now the all records with displying of only fname and lname is required but in this format say my name is abhay khanna it will come like this abhay-khanna rahul-roy gaurav-singh the above format is required
What is difference between joins and subqueries?
You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?
What are sql server functions?
How to create a view and a stored procedure in ms sql server using "create view/procedure" statements?
Explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?
What is the default isolation level of the sql server database?