SQL By INDOMITABLE LIMITEDOctober 14, 2025October 24, 2025 Welcome to your SQL SQL Which SQL keyword is used to remove duplicate rows from a result set? DIFFERENT DISTINCT UNIQUE REMOVE None SQL Which SQL clause is used to filter records? ORDER BY HAVING GROUP BY WHERE None SQL Which SQL command is used to save all changes made during the transaction? SAVE COMMIT EXECUTE APPLY None SQL What is the purpose of the EXPLAIN command in SQL? Shows data Displays the execution plan of a query Explains syntax errors Lists all tables None SQL What does a clustered index do? Prevents duplication Optimizes joins Creates a secondary data structure Sorts and stores data rows in order None SQL Which of these joins returns all records when there is a match in either table? FULL OUTER JOIN RIGHT JOIN LEFT JOIN INNER JOIN None SQL What will the query SELECT COUNT(DISTINCT department_id) return? Total null department IDs Total departments Total unique department IDs Total employees None SQL Which of the following is used to prevent duplicate entries in a table? DEFAULT constraint FOREIGN KEY constraint UNIQUE constraint CHECK constraint None SQL What does the ON DELETE CASCADE option do? Prevents deletion Deletes all records in the table Ignores delete operation Deletes related rows when a parent row is deleted None SQL Which of the following can improve query performance? Removing indexes Increasing columns Adding indexes Using SELECT * None SQL What is a subquery? A system query A query inside another query A query that runs independently A stored procedure None SQL Which function is used to return the current date in SQL? SYSDATE() NOW() DATE() CURRENT() None SQL Which SQL statement is used to combine rows from two or more tables? UNION JOIN INTERSECT COMBINE None SQL What does the GROUP BY clause do? Groups rows with the same values Sorts data Deletes duplicates Filters data None SQL Which SQL constraint ensures that all values in a column are unique? UNIQUE FOREIGN KEY PRIMARY KEY NOT NULL None SQL Which SQL statement is used to create a new table? MAKE TABLE CREATE TABLE NEW TABLE ADD TABLE None SQL Which function returns the average value of a numeric column? MEDIAN() MEAN() AVG() SUM() None What is a foreign key used for? To allow duplicate records To enforce referential integrity between tables To encrypt data To uniquely identify each record None SQL What is the difference between INNER JOIN and LEFT JOIN? LEFT JOIN excludes matching rows INNER JOIN includes unmatched rows Both are the same LEFT JOIN includes all rows from the left table None SQL Which keyword is used to rename a column or table in SQL? AS ALIAS UPDATE RENAME None SQL Which of the following is a valid SQL data type? Float String Both a and c Integer None SQL What is the purpose of the LIMIT clause? To specify the maximum number of rows to return To define constraints To filter rows To count rows None SQL Which aggregate function returns the highest value in a column? MAX() HIGH() UPPER() None SQL Which SQL keyword is used to sort results? SORT ORDER BY GROUP BY FILTER None SQL Which of the following statements will delete all rows in a table named ‘students’? a) b) c) d) DELETE FROM students; REMOVE * FROM students; DROP students; CLEAR TABLE students; None Time's up