Database - Introduction to SQL - Discussion

Discussion :: Introduction to SQL - General Questions (Q.No.32)


A subquery in an SQL SELECT statement:

[A]. can only be used with two tables.
[B]. can always be duplicated by a join.
[C]. has a distinct form that cannot be duplicated by a join.
[D]. cannot have its results sorted using ORDER BY.

Answer: Option C


No answer description available for this question.

Gayatri said: (May 20, 2011)  
Please could someone explain the answer. Many thanks.

Durg said: (Jan 21, 2012)  
select * from(select * from <table> where <condition>)<alias> order by <alias>

Mohd Salman said: (May 23, 2014)  
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.

Amol said: (Sep 18, 2016)  
I think, the last option is also correct.

Amol said: (Sep 18, 2016)  
Subqueries use GROUP BY instead of ORDER BY for sorting.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.