Hi,
select * from table where 3 > 2 what will return this query? anyone explain this query??
Select * from table where 3 > 2 what will return this query? anyone explain this query??
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Blocked AccountRank #403 · 6.2K reputationPosted Dec 10, 2012, 5:46 PM EST
This query will return all the records of the table because condition is true
in where clause you have written 3>2, which is always true.
Rohatash KumarRank #12 · 57.7K reputationPosted Dec 10, 2012, 5:57 PM EST
In where clause 3>2 condition is true. It will return all the records of the table. If you write condition 2>3. This condition is false. It will not return any record from the table only structure of the table will be display.
Shankar MRank #874 · 2.5K reputationPosted Dec 12, 2012, 2:08 AM EST
The where clause condition 3 >2 is satisfied and the query will return all the records
from the table.
We can write such query to create a table based on the existing definition of the table like,
CREATE TABLE tablex AS SELECT * FROM EMP WHERE 3 >2;
The above statement creates tablex with all the rows from the emp table. If you need to
copy only the structure of the existing table then you can query :
CREATE TABLE tablex AS SELECT * FROM EMP WHERE 1=0;
The above statement creates tablex with the definition of EMP table and with no rows.