Discussion
A subquery in an SQL SELECT statement:
Answer: C
Correct answer: has a distinct form that cannot be duplicated by a join.
Many subqueries can be rewritten as joins, but not all. A correlated EXISTS or NOT EXISTS, and a comparison against an aggregate of a related set - WHERE salary > (SELECT AVG(salary) FROM emp) - have no direct join equivalent.
The reason is that a join combines rows while a subquery can compute a value or test existence without producing rows. Subqueries are also not limited to two tables, and their outer query can certainly be sorted with ORDER BY.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development