PRACTICE • LEARN • GROW
Module 6 Final Quiz: SQL Joins, Subqueries & Views MCQs
Solve topic-wise placement questions and improve your skills.
Module 6 Final Quiz: SQL Joins, Subqueries & Views Progress
0 of 11 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Which rows does an INNER JOIN return between Table A and Table B?
A.
All rows from Table A, regardless of matches in Table B
B.
Only the rows where the join condition is satisfied and matching keys exist in BOTH Table A and Table B
C.
All rows from both tables, filling mismatches with NULL
D.
Rows that exist in Table A but NOT in Table B
Explanation & Key
Correct Answer:
2
In a LEFT OUTER JOIN between Customers (left) and Orders (right), what appears in the Orders columns if a customer has placed no orders?
A.
The row is omitted from the result set
B.
The customer information appears, and all Orders columns evaluate to NULL
C.
The query aborts with a foreign key violation
D.
Zero is placed in every column
Explanation & Key
Correct Answer:
3
How can you query for all customers who have NEVER placed an order using a LEFT JOIN?
A.
SELECT * FROM Customers c LEFT JOIN Orders o ON c.id = o.customer_id WHERE o.order_id IS NULL;
B.
SELECT * FROM Customers c LEFT JOIN Orders o ON c.id = o.customer_id WHERE o.order_id = 0;
C.
SELECT * FROM Customers c INNER JOIN Orders o ON c.id = o.customer_id WHERE o.customer_id IS NULL;
D.
SELECT * FROM Customers c FULL JOIN Orders o ON c.id = o.customer_id WHERE c.id IS NULL;
Explanation & Key
Correct Answer:
4
What is a FULL OUTER JOIN?
A.
A join that returns the Cartesian product of both tables
B.
A join that returns all rows from both tables, pairing matching rows together and padding with NULLs whenever there is no match on either side
C.
A join on all columns of the same name
D.
A join that deletes duplicate rows
Explanation & Key
Correct Answer:
5
What is a SELF JOIN, and what is its most common real-world use case?
A.
Joining a table to a foreign server
B.
Joining a table to itself using aliases, commonly used to model hierarchical or recursive parent-child data (e.g. Employee and Manager in the same table)
C.
Joining two tables with identical schemas
D.
A query that calls itself recursively
Explanation & Key
Correct Answer:
6
Why should you avoid using NATURAL JOIN in production software?
A.
Because NATURAL JOIN is not supported in SQL standards
B.
Because it implicitly joins on ALL columns sharing the same name in both tables; adding an innocent column like 'created_at' or 'status' silently corrupts query results
C.
Because it runs 1000x slower than INNER JOIN
D.
Because it can only return 1 row
Explanation & Key
Correct Answer:
7
What is a Correlated Subquery?
A.
A subquery that executes once before the outer query runs
B.
A subquery that references one or more columns from the outer query, requiring the inner subquery to re-evaluate for EVERY row processed by the outer query
C.
A subquery that joins two databases together
D.
A subquery containing a UNION ALL operator
Explanation & Key
Correct Answer:
8
When is the EXISTS operator preferable to the IN operator in SQL subqueries?
A.
EXISTS is always slower than IN
B.
EXISTS short-circuits as soon as it finds the first matching row (returning TRUE without scanning the entire inner table) and handles NULL values predictably
C.
IN can only be used with numbers
D.
EXISTS converts queries into DDL
Explanation & Key
Correct Answer:
9
What is a Database View?
A.
A physical printout of the database diagram
B.
A virtual table defined by a stored SQL query that does not store raw data tuples physically (unless materialized)
C.
A software tool for drawing ER diagrams
D.
An index that speeds up sorting
Explanation & Key
Correct Answer:
10
What is a Materialized View?
A.
A view displayed on a projector screen
B.
A view whose query results are physically computed and stored on disk, and periodically refreshed to deliver fast analytical reads at the cost of storage and write overhead
C.
A view that cannot be indexed
D.
A view that only exists in RAM
Explanation & Key
Correct Answer:
11
Under what general condition can an SQL View be directly updated (INSERT/UPDATE/DELETE)?
A.
Any view can always be updated
B.
The view must be defined on a single base table without aggregate functions, DISTINCT, GROUP BY, or UNION clauses
C.
The view must contain at least 3 JOINs
D.
Views are never updatable under any circumstance
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong