100 SQL Queries MCQs with Answers (Beginner to Advanced) – Practice Test & Exam Preparation, Download and practice 100 SQL Queries MCQs with answers covering SELECT, JOIN, WHERE, GROUP BY, HAVING, subqueries, and aggregate functions. Perfect for students, exams, interviews, and database certification preparation.
If you are preparing for exams, interviews, or database certifications, mastering SQL queries is essential. This comprehensive collection of 100 SQL Queries MCQs with answers is designed for beginners, intermediate learners, and advanced students who want to strengthen their understanding of core database concepts. The questions cover important topics such as SELECT statements, WHERE clauses, JOIN operations, GROUP BY, HAVING, subqueries, aggregate functions, constraints, and data manipulation commands. Whether you are a computer science student, IT professional, or aspiring database developer, these SQL multiple-choice questions will help you practice effectively, test your knowledge, and improve your confidence in writing and understanding SQL queries.
1. What does SQL stand for?
A) Structured Question Language
B) Simple Query Language
C) Structured Query Language
D) System Query Language
Answer: C
2. Which SQL statement is used to retrieve data from a database?
A) GET
B) SELECT
C) FETCH
D) RETRIEVE
Answer: B
3. Which clause is used to filter records?
A) ORDER BY
B) GROUP BY
C) WHERE
D) HAVING
Answer: C
4. Which statement is used to insert new data?
A) ADD
B) INSERT INTO
C) UPDATE
D) CREATE
Answer: B
5. Which SQL clause is used to sort the result set?
A) GROUP BY
B) ORDER BY
C) SORT BY
D) ARRANGE BY
Answer: B
6. Which command is used to update existing records?
A) MODIFY
B) CHANGE
C) UPDATE
D) EDIT
Answer: C
7. Which command is used to delete records?
A) REMOVE
B) DELETE
C) DROP
D) ERASE
Answer: B
8. Which clause groups rows sharing a property?
A) ORDER BY
B) WHERE
C) GROUP BY
D) SORT
Answer: C
9. Which clause is used with aggregate functions to filter groups?
A) WHERE
B) HAVING
C) GROUP BY
D) ORDER BY
Answer: B
10. Which function returns the number of rows?
A) SUM()
B) COUNT()
C) TOTAL()
D) NUMBER()
Answer: B
11. Which function returns the maximum value?
A) MAX()
B) HIGH()
C) TOP()
D) LARGE()
Answer: A
12. Which function returns the minimum value?
A) MIN()
B) LOW()
C) SMALL()
D) BOTTOM()
Answer: A
13. Which function calculates the average?
A) AVG()
B) AVERAGE()
C) MEAN()
D) CALC()
Answer: A
14. Which function calculates the total sum?
A) ADD()
B) TOTAL()
C) SUM()
D) PLUS()
Answer: C
15. Which operator is used for pattern matching?
A) MATCH
B) LIKE
C) IN
D) BETWEEN
Answer: B
16. Which wildcard represents multiple characters?
A) _
B) *
C) %
D) ?
Answer: C
17. Which wildcard represents a single character?
A) _
B) %
C) *
D) #
Answer: A
18. Which operator checks for a range of values?
A) IN
B) RANGE
C) BETWEEN
D) LIMIT
Answer: C
19. Which operator checks for multiple possible values?
A) BETWEEN
B) IN
C) LIKE
D) EXISTS
Answer: B
20. Which SQL keyword is used to remove duplicate values?
A) UNIQUE
B) DISTINCT
C) DIFFERENT
D) REMOVE
Answer: B
21. Which clause limits the number of returned rows (MySQL)?
A) LIMIT
B) TOP
C) FETCH
D) ROWNUM
Answer: A
22. Which keyword selects all columns?
A) ALL
B) *
C) FULL
D) COLUMN
Answer: B
23. Which statement creates a new table?
A) CREATE TABLE
B) NEW TABLE
C) ADD TABLE
D) MAKE TABLE
Answer: A
24. Which statement deletes a table permanently?
A) DELETE TABLE
B) REMOVE TABLE
C) DROP TABLE
D) ERASE TABLE
Answer: C
25. Which statement modifies an existing table?
A) MODIFY TABLE
B) ALTER TABLE
C) UPDATE TABLE
D) CHANGE TABLE
Answer: B
26. Which JOIN returns all records from both tables?
A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL JOIN
Answer: D
27. Which JOIN returns matching records only?
A) INNER JOIN
B) FULL JOIN
C) LEFT JOIN
D) RIGHT JOIN
Answer: A
28. Which JOIN returns all records from left table and matched from right?
A) RIGHT JOIN
B) LEFT JOIN
C) INNER JOIN
D) FULL JOIN
Answer: B
29. Which JOIN returns all records from the right table and matches from left?
A) LEFT JOIN
B) INNER JOIN
C) RIGHT JOIN
D) FULL JOIN
Answer: C
30. Which clause is used to rename a column?
A) AS
B) RENAME
C) ALIAS
D) NAME
Answer: A
31. Which statement is used to combine the result sets of two SELECT statements?
A) JOIN
B) UNION
C) MERGE
D) COMBINE
Answer: B
32. Which operator removes duplicate records in combined results?
A) JOIN
B) DISTINCT
C) UNION
D) UNION ALL
Answer: C
33. Which operator keeps duplicate records when combining results?
A) UNION
B) DISTINCT
C) UNION ALL
D) MERGE ALL
Answer: C
34. Which clause is used to check for NULL values?
A) = NULL
B) IS NULL
C) NULL =
D) EQUAL NULL
Answer: B
35. Which clause is used to check for NOT NULL values?
A) NOT NULL
B) IS NOT NULL
C) != NULL
D) NULL <>
Answer: B
36. What is a subquery?
A) A query inside another query
B) A backup query
C) A delete query
D) A grouped query
Answer: A
37. Which keyword is used to test for the existence of records in a subquery?
A) IN
B) EXISTS
C) CHECK
D) FOUND
Answer: B
38. Which operator is used to compare a value to any value in a subquery?
A) ALL
B) ANY
C) EXISTS
D) IN
Answer: B
39. Which operator compares a value to all values in a subquery?
A) ANY
B) ALL
C) IN
D) EXISTS
Answer: B
40. Which clause defines a primary key?
A) PRIMARY
B) PRIMARY KEY
C) MAIN KEY
D) UNIQUE KEY
Answer: B
41. A primary key must be:
A) Duplicate
B) NULL
C) Unique and NOT NULL
D) Optional
Answer: C
42. Which constraint ensures unique values in a column?
A) PRIMARY KEY
B) UNIQUE
C) NOT NULL
D) CHECK
Answer: B
43. Which constraint prevents NULL values?
A) UNIQUE
B) CHECK
C) NOT NULL
D) DEFAULT
Answer: C
44. Which constraint provides a default value?
A) CHECK
B) DEFAULT
C) UNIQUE
D) AUTO
Answer: B
45. Which constraint ensures referential integrity?
A) PRIMARY KEY
B) UNIQUE
C) FOREIGN KEY
D) CHECK
Answer: C
46. Which statement is used to create a view?
A) CREATE VIEW
B) MAKE VIEW
C) NEW VIEW
D) ADD VIEW
Answer: A
47. A view is:
A) A physical table
B) A virtual table
C) A stored procedure
D) An index
Answer: B
48. Which statement removes a view?
A) DELETE VIEW
B) DROP VIEW
C) REMOVE VIEW
D) ERASE VIEW
Answer: B
49. Which command saves changes permanently?
A) SAVE
B) COMMIT
C) STORE
D) APPLY
Answer: B
50. Which command undoes changes?
A) ROLLBACK
B) CANCEL
C) UNDO
D) REMOVE
Answer: A
51. Which command sets a savepoint in a transaction?
A) SAVE
B) SAVEPOINT
C) CHECKPOINT
D) MARK
Answer: B
52. Which clause is used in CASE statements?
A) WHEN
B) IF
C) SWITCH
D) SELECT
Answer: A
53. Which keyword ends a CASE statement?
A) STOP
B) END
C) FINISH
D) CLOSE
Answer: B
54. Which command creates an index?
A) ADD INDEX
B) CREATE INDEX
C) MAKE INDEX
D) NEW INDEX
Answer: B
55. What is the purpose of an index?
A) Delete records
B) Speed up queries
C) Sort data permanently
D) Group records
Answer: B
56. Which statement removes an index?
A) DELETE INDEX
B) DROP INDEX
C) REMOVE INDEX
D) ERASE INDEX
Answer: B
57. Which function converts text to uppercase?
A) UPPER()
B) CAPITAL()
C) LARGE()
D) BIG()
Answer: A
58. Which function converts text to lowercase?
A) LOWER()
B) SMALL()
C) MIN()
D) DOWN()
Answer: A
59. Which function returns the length of a string?
A) SIZE()
B) COUNT()
C) LENGTH()
D) CHARCOUNT()
Answer: C
60. Which function extracts part of a string?
A) CUT()
B) SUBSTRING()
C) EXTRACT()
D) PART()
Answer: B
61. Which operator concatenates strings?
A) +
B) &
C) ||
D) CONCAT
Answer: C
62. Which function returns current date?
A) NOW()
B) TODAY()
C) CURRENT_DATE
D) DATE()
Answer: C
63. Which function returns current date and time?
A) CURRENT_TIMESTAMP
B) TODAY()
C) DATE()
D) TIME()
Answer: A
64. Which clause is evaluated first?
A) SELECT
B) WHERE
C) FROM
D) ORDER BY
Answer: C
65. Which keyword is used to sort in descending order?
A) DOWN
B) DESC
C) DECREASE
D) LOWER
Answer: B
66. Which keyword sorts in ascending order?
A) ASC
B) UP
C) INCREASE
D) RISE
Answer: A
67. Which clause limits rows in SQL Server?
A) LIMIT
B) TOP
C) FETCH
D) ROWNUM
Answer: B
68. Which operator is used for logical AND?
A) &&
B) AND
C) &
D) BOTH
Answer: B
69. Which operator is used for logical OR?
A) ||
B) OR
C) EITHER
D) AND
Answer: B
70. Which operator negates a condition?
A) NO
B) NOT
C) NONE
D) STOP
Answer: B
71. Which command adds a new column?
A) ADD COLUMN
B) INSERT COLUMN
C) ALTER TABLE ADD
D) CREATE COLUMN
Answer: C
72. Which command removes a column?
A) DELETE COLUMN
B) DROP COLUMN
C) REMOVE COLUMN
D) ERASE COLUMN
Answer: B
73. Which constraint checks the condition before inserting data?
A) UNIQUE
B) CHECK
C) DEFAULT
D) PRIMARY
Answer: B
74. Which keyword retrieves unique records?
A) UNIQUE
B) DISTINCT
C) SINGLE
D) ONE
Answer: B
75. Which clause filters before grouping?
A) HAVING
B) WHERE
C) ORDER BY
D) GROUP BY
Answer: B
76. Which clause filters after grouping?
A) WHERE
B) GROUP BY
C) HAVING
D) SELECT
Answer: C
77. Which command removes all records but keeps the table structure?
A) DELETE
B) DROP
C) TRUNCATE
D) REMOVE
Answer: C
78. Which command removes table structure and data?
A) DELETE
B) DROP
C) TRUNCATE
D) CLEAR
Answer: B
79. Which clause is mandatory in the SELECT statement?
A) WHERE
B) ORDER BY
C) SELECT
D) GROUP BY
Answer: C
80. Which keyword renames a table?
A) RENAME
B) ALTER TABLE RENAME
C) MODIFY
D) CHANGE
Answer: B
81. Which function replaces NULL with a value (MySQL)?
A) ISNULL()
B) IFNULL()
C) NULLVALUE()
D) CHECKNULL()
Answer: B
82. Which clause selects the top rows in Oracle?
A) LIMIT
B) ROWNUM
C) TOP
D) FETCH
Answer: B
83. Which join creates the Cartesian product?
A) INNER JOIN
B) CROSS JOIN
C) LEFT JOIN
D) RIGHT JOIN
Answer: B
84. Which keyword removes duplicate rows in GROUP BY results?
A) DISTINCT
B) UNIQUE
C) HAVING
D) ORDER
Answer: A
85. Which statement defines a stored procedure?
A) CREATE FUNCTION
B) CREATE PROCEDURE
C) MAKE PROCEDURE
D) NEW PROCEDURE
Answer: B
86. Which statement executes a stored procedure?
A) RUN
B) EXEC
C) CALL
D) START
Answer: B
87. Which object automatically executes on table events?
A) View
B) Trigger
C) Index
D) Function
Answer: B
88. Which statement creates a trigger?
A) CREATE TRIGGER
B) MAKE TRIGGER
C) ADD TRIGGER
D) NEW TRIGGER
Answer: A
89. Which command changes column data type?
A) MODIFY
B) ALTER TABLE MODIFY
C) UPDATE TYPE
D) CHANGE TYPE
Answer: B
90. Which keyword is used for conditional logic in SQL?
A) IF
B) CASE
C) SWITCH
D) LOOP
Answer: B
91. Which statement deletes specific rows?
A) DROP
B) DELETE
C) TRUNCATE
D) CLEAR
Answer: B
92. Which command begins a transaction?
A) START TRANSACTION
B) BEGIN
C) OPEN
D) INIT
Answer: A
93. Which keyword checks whether a value exists in a list?
A) EXISTS
B) IN
C) BETWEEN
D) ANY
Answer: B
94. Which SQL clause retrieves data from tables?
A) SELECT
B) FROM
C) WHERE
D) GROUP BY
Answer: B
95. Which clause must come after SELECT?
A) WHERE
B) GROUP BY
C) FROM
D) ORDER BY
Answer: C
96. Which statement changes existing data?
A) ALTER
B) UPDATE
C) MODIFY
D) CHANGE
Answer: B
97. Which clause sorts multiple columns?
A) GROUP BY
B) ORDER BY
C) SORT BY
D) ARRANGE
Answer: B
98. Which keyword removes specific constraints?
A) DELETE CONSTRAINT
B) DROP CONSTRAINT
C) REMOVE CONSTRAINT
D) ERASE CONSTRAINT
Answer: B
99. Which function rounds numeric values?
A) ROUND()
B) FORMAT()
C) FIX()
D) CEIL()
Answer: A
100. Which SQL statement retrieves all data from a table?
A) SELECT ALL FROM table_name;
B) SELECT * FROM table_name;
C) GET * FROM table_name;
D) FETCH ALL table_name;
Answer: B
Advertisement:


