Q1. SQL stands for:
- A.Standard Question Language
- B.Structured Query Language✓ Correct
- C.System Query Logic
- D.Simple Query Language
Explanation
SQL stands for Structured Query Language.
Topic in Databases
SQL (Structured Query Language) is the standard declarative language for defining, querying and modifying data in relational databases. Questions separate DDL commands such as CREATE, ALTER and DROP from DML commands like SELECT, INSERT, UPDATE and DELETE, and ask how a WHERE clause limits which rows change. You should know the logical order of SELECT clauses, GROUP BY with HAVING, aggregate functions and their NULL handling, LIKE wildcards, BETWEEN and IN, and the different JOIN types. Subqueries matter too: EXISTS versus IN, correlated subqueries that re-run for each outer row, and recursive common table expressions for hierarchical data.
Below are 30 practice questions from a pool of 210 SQL MCQs, one of 17 topics in Databases. Each shows the correct answer with an explanation; when you are ready, take a timed quiz to test recall under exam conditions.
Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.
Q1. SQL stands for:
SQL stands for Structured Query Language.
Q2. Which SQL statement is used to retrieve data from a database?
The SELECT statement is used to retrieve data from one or more tables.
Q3. Which SQL clause is used to filter rows?
The WHERE clause filters rows based on specified conditions.
Q4. Which SQL statement adds new rows to a table?
INSERT INTO is used to add new rows to a table.
Q5. Which SQL statement modifies existing data?
The UPDATE statement modifies existing data in a table.
Q6. Which SQL statement removes rows from a table?
The DELETE statement removes rows from a table based on a condition.
Q7. Which SQL command creates a new table?
CREATE TABLE is used to create a new table in the database.
Q8. Which SQL command permanently removes a table?
DROP TABLE permanently removes a table and all its data from the database.
Q9. The ORDER BY clause is used to:
ORDER BY sorts the result set in ascending or descending order.
Q10. Which keyword is used to remove duplicate rows from a result?
The DISTINCT keyword eliminates duplicate rows from the result set.
Q11. Which SQL clause is used to filter groups in a GROUP BY query?
HAVING filters groups after GROUP BY, while WHERE filters individual rows before grouping.
Q12. An INNER JOIN returns:
INNER JOIN returns only the rows where there is a match in both tables.
Q13. Which aggregate function returns the number of rows?
COUNT() returns the number of rows that match a specified condition.
Q14. A LEFT JOIN returns:
LEFT JOIN returns all rows from the left table, with NULLs for non-matching right table columns.
Q15. Which SQL constraint ensures a column cannot have NULL values?
The NOT NULL constraint ensures that a column cannot have NULL values.
Q16. The LIKE operator is used with which wildcard characters?
The LIKE operator uses % (any sequence of characters) and _ (a single character) as wildcards.
Q17. What does the IN operator do in SQL?
The IN operator checks whether a value matches any value in a specified list or subquery.
Q18. Which SQL clause limits the number of rows returned?
LIMIT (MySQL/PostgreSQL) or TOP (SQL Server) restricts the number of returned rows.
Q19. A subquery is:
A subquery is a SELECT statement nested within another SQL statement.
Q20. The BETWEEN operator selects values:
BETWEEN selects values within an inclusive range (including both endpoints).
Q21. A correlated subquery is different from a regular subquery because it:
A correlated subquery references the outer query's columns and re-executes for each row of the outer query.
Q22. The COALESCE function in SQL:
COALESCE returns the first non-NULL expression in the list of arguments.
Q23. What is the difference between DELETE and TRUNCATE?
DELETE is DML, can have WHERE, and logs each row deletion. TRUNCATE is DDL, removes all rows, and is minimally logged.
Q24. The CASE expression in SQL is used for:
The CASE expression provides if-then-else conditional logic within SQL queries.
Q25. A CROSS JOIN produces:
A CROSS JOIN produces the Cartesian product — every row from the first table paired with every row from the second.
Q26. Which SQL statement is used to create an index?
CREATE INDEX is used to create an index on one or more columns of a table.
Q27. The EXISTS operator in SQL:
EXISTS returns TRUE if the subquery returns one or more rows.
Q28. A self-join is:
A self-join joins a table with itself, typically using aliases to distinguish the two instances.
Q29. UNION vs UNION ALL in SQL:
UNION removes duplicate rows from the combined result, while UNION ALL includes all rows.
Q30. What does the NVL/IFNULL/ISNULL function do?
These functions replace NULL values with a specified default value (syntax varies by DBMS).
Practice MCQs with explanations
Practice MCQs with explanations
Practice MCQs with explanations
Practice MCQs with explanations
Practice MCQs with explanations
Practice MCQs with explanations
Take a timed quiz drawn from 210+ questions on this topic. No signup required — your progress saves in your browser.
Start SQL Quiz