WorksheetsSubqueries Quiz
Total questions: 15
Worksheet time: 8mins
Name
Class
Date
1.
What does a subquery let you do in SQL?
a)
Make a table look nicer
b)
Delete columns
c)
Use the result of one query inside another
d)
Change column names
2.
What symbol is commonly used to surround a subquery?
a)
Curly braces {}
b)
Square brackets []
c)
Parentheses ()
d)
Angle brackets <>
3.
What SQL clause can name a subquery for reuse?
(a)
4.
In a subquery, what keyword follows the alias name?
a)
BY
b)
IN
c)
AS
d)
FROM
5.
Why are subqueries useful in complex SQL operations?
a)
Improve index use
b)
Reduce table size
c)
Enhance clarity and flexibility
d)
Change data types
6.
What keyword starts a Common Table Expression (CTE) in SQL?
(a)
7.
What clause is typically used after defining a subquery using WITH?
a)
ORDER
b)
JOIN
c)
SELECT
d)
GROUP BY
8.
A subquery can be joined to another table using INNER JOIN.
a)
True
b)
False
9.
Which of the following are valid use cases for subqueries?
a)
Group multiple queries
b)
Apply aggregations before a join
c)
Improve code readability
d)
Sort columns alphabetically
10.
When calculating margin and margin percent, why use a subquery?
a)
To delete duplicate rows
b)
To make your code shorter and clearer
c)
To create new tables
d)
To rename columns
11.
What is one reason to use JOIN instead of a nested subquery?
a)
Subqueries are deprecated
b)
JOINs can filter NULLs
c)
JOINs allow access to all columns
d)
JOINs are required by SQL
12.
Why must subqueries used with IN return only one column?
a)
SQL doesn't support multiple columns
b)
It prevents errors in the GROUP BY
c)
IN only checks values in a single column
d)
JOINs can't handle multiple columns
13.
Which method would remove duplicates when combining results from two tables?
a)
UNION ALL
b)
JOIN
c)
SELECT DISTINCT
d)
UNION
14.
Nested subqueries can be used in the SELECT, FROM, and WHERE clauses.
a)
True
b)
False
15.
What clause can use a subquery to compare each row to a list of values?
(a)
100 %
