What is the diffrence between IN and EXISTS.which one is
faster.
Answer Posted / neha
In the in clause, the inner query is executed first, hence if the inner query return less data than the outer query, then use IN clause, in the other scenario, user exists clause.
Also, in the exists clause the inner query always reference outer query's table, which may or may not be the case with in IN clause.
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Can you rollback after commit?
What is trigger and stored procedure in sql?
What is a record in a database?
What is the difference between syntax error and runtime error?
How do I pipe the output of one isql to another?
how to create a new table by selecting rows from another table in mysql? : Sql dba
What is function and procedure?
Compare sql & pl/sql
What is embedded sql in db2?
How do you create a db file?
Define select, insert, create, delete, update, drop keywords
Can we insert delete data in view?
What is procedure function?
What is the usage of distinct keyword?
Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10