ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
What is the difference between two queries:
1. SELECT * FROM table WHERE 1=1;
2. SELECT * FROM table
 Question Submitted By :: Vinod
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 1
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 ?    8 Yes 12 No
Kohulavani.g
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 2
No Diffrence at all
 
Is This Answer Correct ?    13 Yes 5 No
Rajiv Rohilla
 
 
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 3
Both the Queries will return the same ouput.
That means it will return all the rows that are available 
in the table.
 
Is This Answer Correct ?    12 Yes 2 No
Malathi
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 4
in first query 1=1 always true,then it retrives all columns 
in a table.
so,there is no difference in between these two
 
Is This Answer Correct ?    9 Yes 3 No
G.nageswara Rao
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 5
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 8 No
Kranthi Kiran
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 6
There is No Difference between these two
 
Is This Answer Correct ?    4 Yes 1 No
Vijay
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 7
Both are returns the SAME results.

I dont know the meaning of the 
SELECT * FROM Table_Name WHERE 1=1
SELECT * FROM Table_Name WHERE 2=2
SELECT * FROM Table_Name WHERE 5=5
SELECT * FROM Table_Name WHERE 100=100
.
.
.
etc..,

It accepts the where both are equal.

If you give like 

SELECT * FROM Table_Name WHERE 100=1001
It is not accept.
 
Is This Answer Correct ?    8 Yes 0 No
Skumar
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 8
hey! I too agree there wont be any difference in result it 
displays but the performance will be different. While 
executing the first query the where condition to be checked 
for each record it displays hence it takes much time to 
execute while compared with question no 2 i.e, without 
where condition. this is what I believe in.
 
Is This Answer Correct ?    2 Yes 1 No
Pavan
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 9
Of course, both the Queries will get you the same data but,

When compared to the first case processing time will be 
slightly reduced in the second case.

Bytes sent from client and Bytes received from server will 
be more in the first case.

and one more thing is better not using "select * from ..."
 
Is This Answer Correct ?    6 Yes 0 No
Krishna Sandeep
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 10
Both are same .
They r showing all results.
 
Is This Answer Correct ?    1 Yes 1 No
Hasan
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 11
The first query satisfies the condition true condition.

both are similar but not same. performance based querys ...
 
Is This Answer Correct ?    3 Yes 0 No
Akbar Ali
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 12
No difference
 
Is This Answer Correct ?    2 Yes 0 No
Naren
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 13
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 ?    0 Yes 0 No
Hitesh Taneja
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 14
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 ?    0 Yes 0 No
Chinnu
 
  Re: What is the difference between two queries: 1. SELECT * FROM table WHERE 1=1; 2. SELECT * FROM table
Answer
# 15
The results of both queries will be same
but 2nd will fast then 1st

vidit Tyagi
Meerut
 
Is This Answer Correct ?    1 Yes 0 No
Vidit
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
How to restart SQL Server in single user mode? How to start SQL Server in minimal configuration mode?  1
what is the main difference between after trigger and instead trigger.  1
1.what is the difference between view and cursor? 2.If we do any change in view will it affect the database,similarly when we do changes in cursor will it affect the databse?with certain example?Thanks  3
table:employee EID ENAME MID(manager ids) 101 rama null 102 sita 101 103 siva 101 104 ganesh 103 . . . . . . for 103 ID the manager ID is 101(RAMA) and for 104 manager is SIVA if i give employee id (EID) you have to tell the manager for that EID write query? eample:if i give 102 .The query output should be manager for 102 ID that it should print RAMA as output  5
What are the types of indexes available with SQL Server?  2
How can u convert the Date to String? TCS4
What is the difference between temp table and table variable? Microsoft4
Which databases are part of SQL server default installation? Explain the usage of each? Accenture2
can we call functions from stored procedure in SQL Server 2005 ? How?  2
What is normalization?  6
why cluster and non clusterindex are used in sqlserver 2000? explain with example  1
what is the difference between sql query and google query? TCS6
how to rest identity columns in sql server Matrix3
how to copy sysdatabase file from c: Drive to D: Drive in SQL Server. IBM4
where do you use Isolations?give me some exmpale?  1
What is a sub-query? When would you use one?  3
is it possible to use a variable in a query with the IN clause (a,b,c..z), without getting quotes or conversion errors?  2
How can count the string ? for ex: If i have string like 'bhaskar' then i need like b:1 h:1 a:2 s:1 k:1 r:1 please give any idea on that TCS5
If there is failure during updation of certain rows, what will be the state?  1
What is blocking and how would you troubleshoot it? HCL2
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com