What is the difference between two queries:
1. SELECT * FROM table WHERE 1=1;
2. SELECT * FROM table
Answers were Sorted based on User's Feedback
Answer / hitesh taneja
When we use 1=1 or any condition which is always going to
true, it will take extra bit of time bcoz it is a condion so
althouth the output of the query will be the same the
performance time will be bit higher with condition.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / vidit
The results of both queries will be same
but 2nd will fast then 1st
vidit Tyagi
Meerut
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / niranjan prasad
There is no defference in result. It shows same result-set
by using both the command.This question put you to misguide
only.
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / chinnu
Hi SQL gurus,
i am working for an MNC...
My team is having a problem in sql server. when user slects
date prompts from jan 1st to april 30, it should display
all months data like :
jan aa
feb bb
mar cc
but when it comes to april its taking data like :
jan aa
feb bb
mar cc
apr dd...and so on
means its taking data again from jan to april which we dont
want. we want the data only april month as we are getting
jan, feb and mar...
can any one write the code to relsove the issue please
would be greatful if you can send to shiva_sans@yahoo.co.in
and also please send your email also ...so that we will be
in touch for any kind of queries ...
Thanks a lot in Advance !!!
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / rohit nanda
NO DIFFERENCE IN BOTH THE EQUATION...BCOZ THEY GIVE THE SAME
OUTPUT....
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / kohulavani.g
First query,in table where 1=1 condition is satisfied that
row or column is displayed
But in second query,the whole table is displayed
| Is This Answer Correct ? | 18 Yes | 44 No |
Answer / kranthi kiran
I am learning SQL Basics..So If my Answer is wrong Plz do
reply to tht,
In the First Query Where 1=1 implies Show all where The
first coloum element is equal to 1
and second query show all from table
| Is This Answer Correct ? | 4 Yes | 40 No |
What is sql server database?
What is msdb database? : SQL Server Architecture
Explain what is the difference between union and union all?
Explain the different types of joins?
write down the code for "how we delete a table without using of Drop command " ?
7 Answers CarrizalSoft Technologies, Sonata,
Diffrences between sql server 2000 vs 2005
can i write function in stored procedure and stored procedure in function and nested procedure.Give one example for each question?
What is Deadlock?
How to write a script for upate the data in prod , i have 50000 row are there
Explain user defined views?
what is database replicaion? : Sql server database administration
Explain Geometry datatype in sql server 2008 with example
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)