what is the output of the query select * from emp where 1=2
Answers were Sorted based on User's Feedback
Answer / mithun
hi everyone ,
its a trick to copy the structure of the table wthout the
data .
1 SQL> create table employee1
2 as select * from emp
3 where 1=2;
the compiler will look for the statment 2 first
then it will come to the 3 line to check the condition ,when
it gets a 0 [means false] at that time only the table
structure was there in the buffer ; now it will return to
the 1st statement to create a table with the structure only .
so it will return only the structure of the table .
similarly when this
SELET *
FROM EMP
WHERE 1=2;
querry is executed as per the false conditon it will only
show no rows selected .
hope you get the answer .
have a nice time for any more assistance you can mail me to
ermithun.c@gmail.com
| Is This Answer Correct ? | 27 Yes | 2 No |
Answer / arun
Since we are using SELECT statement for this query,
We can view only the structure of the table. where as if we
use the create query we can copy the structure of the table.
| Is This Answer Correct ? | 24 Yes | 6 No |
Answer / anfal
Hi
When i tried the below query in oracle9i it says no rows
selected. could you please let us know in which version of
Oracle u tried this query.
SQL> select * from emp where 1=2;
no rows selected
| Is This Answer Correct ? | 17 Yes | 2 No |
Answer / ganesh
for sure it will display no rows selected
coz for select * from emp give all and because of the where
clause 1=2.......no point in time 1 is eual to 2 or 2 is
equal to 1....so it returns no row.
eg 1=2 ----give no rows
1=1 ---gives all rows
come out of oracle and think as simple logic (is 1=2)....if
yes true else false.....similar of oracle also
| Is This Answer Correct ? | 12 Yes | 2 No |
Answer / vijay amresh
Hi
When i tried the below query in oracle9i it says no rows
SELET *
FROM EMP
WHERE 1=2;
gives the query for 1=2, it is false so There is no row.
But if it runs for 1=1, then all rows are selected.
| Is This Answer Correct ? | 9 Yes | 1 No |
Answer / suresh kumar somayajula
Hi Anfal,
Try the following Query.
SQL> CREATE TABLE EMP_NEW
AS
SELET *
FROM EMP
WHERE 1=2;
Table Created
SQL> SELECT * FROM EMP_NEW
no rows selected.
SQL> DESC EMP_NEW;
Structure will be displayed.
Please correct me if any mistakes.
Thank you,
Suresh
| Is This Answer Correct ? | 11 Yes | 4 No |
Answer / vikas patil
It is used only for condition checking
for example select * From emp Where 1=2;
it will return 0 rows
select * From emp Where 1=1;
it will return all rows
select * From emp Where 1<2;
it will return all rows
select * From emp Where 1<=1;
it will return all rows
| Is This Answer Correct ? | 2 Yes | 0 No |
Tell me the scenario where sevirity More and Priority Low?
What is meant by Hot Keys?
if anyone ask why did u choose testing field instead of ur core subject after btech in ECE how should i answer
i have doubt suppose iam purly working in manual, when i will work on sql and performence testing? pls any one clarify doubt?
how does a client /server environment affects testing?
which approach u r following while integrating the modules(top down or bottom up) explain process
Hi Friends, Just One Month Back I was Join in Small Company as a Testing Eng.I have Six Month Exp. In this Company all my team memb.r fresher & PM give responsibility on us to prepare all require QC doc. for our new project.So I need ur help in this matter .How Can I start my work and Which Doc.I start to collect & From Where I get Detail Information all abt these thing. Thanks to all friends who give reply to this. Suyog
Define the following and explain their usefulness: Change Management, Configuration Management, Version Control, and Defect Tracking.
When do you go for integration testing?
As a tester I found a show stopper(critical defect) this evening whereas the project is going to be delivered to the client tomorrow morning so there is no time left.I reported the same to my test manager but he is not ready to convinced with me moreover he wants to close the matter as it is....in this senario wat will u do???
wat is ur involvement in user acceptance testing
Actually by using severity you should know which one you need to solve so what is the need of priority?