Advanced SQL MCQs

Topic-wise practice questions for Database Management Systems. Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q11medium
Examine the window function below. If three employees have the exact same salary and are tied for the highest pay, what will the RANK() function return for them?
Q12hard
If Relation R(A, B, C) and Relation S(C, D, E) are joined using a NATURAL JOIN, what will be the attributes (Degree) of the resulting relation?
Q13easy
What is the primary operational difference between a standard VIEW and a MATERIALIZED VIEW?
Q14easy
What is the result of the HAVING clause in this query?
Q15hard
Table A has 5 rows and Table B has 10 rows. If you perform a CROSS JOIN between A and B, but the WHERE clause contains a condition that is always false (e.g., WHERE 1=0), how many rows will be returned?
Q16hard
Table T1 has 3 rows with values {1, 2, NULL}. Table T2 has 3 rows with {1, NULL, NULL}. How many rows are returned by an INNER JOIN on these tables using

T1.val = T2.val?
Q17easy
Analyze the use of the CASE expression. What is returned for a product with stock = 0?
Q18medium
What does the EXISTS keyword do in the following query? mysql - subquery_test

SELECT name FROM Departments d
WHERE EXISTS (
SELECT 1 FROM Employees e
WHERE e.dept_id = d.id AND e.salary > 10000
Q19easy
When should a developer prefer UNION ALL over UNION?