0
0
DBMS Theoryknowledge~5 mins

Subqueries and nested queries in DBMS Theory - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a subquery in SQL?
A subquery is a query written inside another query. It helps to get data that will be used by the main query.
Click to reveal answer
beginner
How does a nested query differ from a simple query?
A nested query is a query inside another query, while a simple query stands alone without any inner queries.
Click to reveal answer
intermediate
Can subqueries return multiple rows or columns?
Yes, subqueries can return one or many rows and columns depending on how they are written and used.
Click to reveal answer
intermediate
Where can subqueries be used in SQL statements?
Subqueries can be used in SELECT, WHERE, FROM, and HAVING clauses to filter, calculate, or join data.
Click to reveal answer
advanced
What is the difference between correlated and non-correlated subqueries?
A correlated subquery depends on the outer query for its values and runs once per row, while a non-correlated subquery runs independently once.
Click to reveal answer
What is a subquery in SQL?
AA query that updates data
BA query inside another query
CA query that deletes tables
DA query that creates indexes
Where can subqueries be used in SQL?
AOnly in SELECT clause
BOnly in WHERE clause
CIn SELECT, WHERE, FROM, and HAVING clauses
DOnly in CREATE statements
What does a correlated subquery depend on?
AIt depends on the user input
BIt runs independently
CIt depends on the database engine
DIt depends on the outer query
Can subqueries return multiple rows?
AYes, they can return multiple rows
BThey return no rows
COnly one column
DNo, only one row
What is a nested query?
AA query inside another query
BA query that deletes data
CA query that creates tables
DA query that runs outside the database
Explain what a subquery is and give an example of where it might be used.
Think about how one query can help another by providing data.
You got /2 concepts.
    Describe the difference between correlated and non-correlated subqueries.
    Consider if the subquery depends on the outer query or not.
    You got /3 concepts.