1. Which SQL clause is used to filter records?
- a) WHERE
- b) HAVING
- c) GROUP BY
- d) ORDER BY
WHERE clause filters records before any groupings are made.
Test your knowledge of Database - [ SQL ] section with these interactive multiple-choice questions.
1. Which SQL clause is used to filter records?
WHERE clause filters records before any groupings are made.
2. What is the primary purpose of an SQL INDEX?
3. Which SQL command permanently removes a table?
DROP TABLE deletes the table structure and its data permanently.
4. What does SQL's ACID stand for?
5. Which join returns all records from the left table?
LEFT JOIN returns all left table records, matched or not.
6. What is the default sorting order of ORDER BY?
ORDER BY sorts in ascending order unless specified otherwise.
7. Which constraint ensures column values are unique?
UNIQUE constraint prevents duplicate values in a column.
8. Which function calculates the number of rows?
COUNT() returns the number of rows matching a criteria.
9. What does DML stand for in SQL?
SELECT, INSERT, UPDATE, DELETE.
10. Which operator checks for NULL values?
IS NULL is the correct way to test for null values.
11. What is the purpose of GROUP BY?
GROUP BY aggregates data by one or more columns.
12. Which command rolls back a transaction?
ROLLBACK undoes changes made in the current transaction.
13. What does a FOREIGN KEY constraint do?
14. Which wildcard matches any sequence of characters?
% matches zero or more characters in LIKE clauses.
15. What is a subquery?
16. Which command modifies existing data?
UPDATE changes existing records in a table.
17. What is the purpose of HAVING?
HAVING filters aggregated data, unlike WHERE.
18. Which SQL function combines strings?
CONCAT() merges two or more strings into one.
19. What does SQL's TRUNCATE TABLE do?
TRUNCATE is faster than DELETE for removing all rows.
20. Which clause removes duplicate rows?
DISTINCT eliminates duplicate values in the result set.