Database - Introduction to SQL - Discussion

Discussion Forum : Introduction to SQL - General Questions (Q.No. 32)
32.
A subquery in an SQL SELECT statement:
can only be used with two tables.
can always be duplicated by a join.
has a distinct form that cannot be duplicated by a join.
cannot have its results sorted using ORDER BY.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
5 comments Page 1 of 1.

Amol said:   6 years ago
Subqueries use GROUP BY instead of ORDER BY for sorting.

Amol said:   6 years ago
I think, the last option is also correct.

Mohd salman said:   9 years ago
We use sub query when we're not sure about the condition in the where clause. Ex get list on emp whose salary is greater than min sal using subquery.

select last_name,salary from employees
where salary >
(select min(salary) from employees)
order by last_name;

Here we have used one column only and sorted the result by order by clause and for joins it has a replacement called as correlated subqueries that fetches informations from two tables.

Durg said:   1 decade ago
select * from(select * from <table> where <condition>)<alias> order by <alias>

Gayatri said:   1 decade ago
Please could someone explain the answer. Many thanks.

Post your comments here:

Your comments will be displayed after verification.