1. What is the primary goal of a DBMS?
a) To visualize data
b) To store and retrieve database information conveniently and efficiently
c) To create graphical user interfaces
d) To replace spreadsheets
2. Which clause is used to filter rows based on specific conditions?
a) ORDER BY
b) GROUP BY
c) WHERE
d) HAVING
3. Which operator returns TRUE if ALL subquery values meet the condition?
a) ANY
b) ALL
c) BETWEEN
d) EXISTS
4. What does the UNION operator require?
a) Same number of columns and similar data types
b) Identical table names
c) Same number of rows
d) Primary key matching
5. Which command is used to give user permissions in SQL?
a) REVOKE
b) COMMIT
c) GRANT
d) SAVEPOINT
6. Which JOIN returns all records from the left table and matched records from the right table?
a) INNER JOIN
b) RIGHT JOIN
c) FULL OUTER JOIN
d) LEFT JOIN
7. Which SQL clause eliminates duplicate rows from the result set?
a) UNIQUE
b) DISTINCT
c) DELETE
d) REMOVE
8. Which operator searches for a specified pattern in a column?
a) IN
b) LIKE
c) BETWEEN
d) EXISTS
9. Which statement creates an index on a table?
a) CREATE INDEX
b) ADD INDEX
c) INDEX TABLE
d) MAKE INDEX
10. What does the COMMIT command do?
a) Rolls back changes
b) Saves changes permanently
c) Creates a backup
d) Deletes a table
11. Which function returns the ASCII value of a character?
a) CHAR()
b) ASCII()
c) CHARINDEX()
d) SUBSTRING()
12. Which mathematical function returns the average value of an expression?
a) AVG()
b) SUM()
c) COUNT()
d) MAX()
13. What does the UPPER() function do?
a) Converts text to lowercase
b) Removes spaces
c) Converts text to uppercase
d) Extracts characters
14. Which function returns the current date and time?
a) GETDATE()
b) CURRENT_DATE()
c) NOW()
d) DATE()
15. Which string function extracts part of a string?
a) LEFT()
b) SUBSTRING()
c) CHARINDEX()
d) REPLICATE()
16. What does the DATEADD() function do?
a) Subtracts dates
b) Returns the difference between two dates
c) Adds a time/date interval to a date
d) Extracts part of a date
17. Which function returns the square of a number?
a) POWER()
b) SQUARE()
c) SQRT()
d) EXP()
18. Which function removes leading spaces from a string?
a) TRIM()
b) LTRIM()
c) RTRIM()
d) CLEAN()
19. What does the DATEDIFF() function return?
a) Sum of two dates
b) Difference between two dates
c) Current timestamp
d) Formatted date
20. Which arithmetic operator returns the remainder of a division?
a) /
b) %
c) *
d) MOD
21. What does the GROUP BY clause do?
a) Sorts data
b) Filters rows
c) Groups rows with the same values
d) Joins tables
22. Which clause filters groups after aggregation?
a) WHERE
b) HAVING
c) ORDER BY
d) GROUP BY
23. What is the correct order of SQL clauses?
a) WHERE → GROUP BY → HAVING → ORDER BY
b) GROUP BY → WHERE → HAVING → ORDER BY
c) WHERE → HAVING → GROUP BY → ORDER BY
d) GROUP BY → HAVING → WHERE → ORDER BY
24. Which function counts the number of rows in a group?
a) SUM()
b) AVG()
c) COUNT()
d) TOTAL()
25. What does the HAVING clause require to be used?
a) WHERE clause
b) GROUP BY clause
c) ORDER BY clause
d) JOIN clause
26. Which command creates a full backup of a database?
a) BACKUP DATABASE
b) SAVE DATABASE
c) EXPORT DATABASE
d) COPY DATABASE
27. Which clause sorts aggregated data?
a) GROUP BY
b) ORDER BY
c) HAVING
d) WHERE
28. What is the purpose of a differential backup?
a) Backs up only new data
b) Backs up only changed data since the last full backup
c) Backs up the entire database again
d) Backs up only table structures
29. Which aggregate function returns the highest value in a set?
a) MAX()
b) MIN()
c) TOP()
d) HIGH()
30. In which clause can you not use aggregate functions?
a) HAVING
b) SELECT
c) WHERE
d) ORDER BY
31. Which of the following is NOT a Boolean operator in SQL?
a) AND
b) OR
c) NOT
d) BETWEEN
31. What does NULL represent in SQL?
a) Zero value
b) Blank space
c) Absence of value
d) Error value
32. Which command removes user permissions?
a) REVOKE
b) DENY
c) REMOVE
d) DELETE
33. Which type of JOIN returns all records when there is a match in either table?
a) INNER JOIN
b) LEFT JOIN
c) FULL OUTER JOIN
d) CROSS JOIN
34. Which SQL statement is used to modify existing records?
a) INSERT
b) UPDATE
c) ALTER
d) MODIFY
35. What is the purpose of the ORDER BY clause?
a) Group rows
b) Filter rows
c) Sort rows
d) Join tables
36. Which operator checks if a value is within a range?
a) IN
b) BETWEEN
c) LIKE
d) EXISTS
37. What does the NOT IN operator do?
a) Includes values in a list
b) Excludes values in a list
c) Checks for NULL values
d) Searches for patterns
38. Which SQL command is part of Transaction Control Language (TCL)?
a) SELECT
b) INSERT
c) COMMIT
d) GRANT
39. What does ACID stand for in transaction management?
a) Atomicity, Consistency, Isolation, Durability
b) Accuracy, Consistency, Integrity, Durability
c) Atomicity, Concurrency, Integrity, Durability
d) Accuracy, Concurrency, Isolation, Durability
40. You want to find customers who have placed orders totaling more than $5000. Which clause
should you use?
a) WHERE
b) HAVING
c) GROUP BY
d) ORDER BY
41. You need to combine results from two SELECT statements into one result set. Which operator
should you use?
a) JOIN
b) UNION
c) MERGE
d) COMBINE
42. Which function would you use to find the length of a string in bytes?
a) LEN()
b) DATALENGTH()
c) CHARLEN()
d) STRLEN()
43. You want to retrieve only the first 10 rows from a table. Which clause should you use?
a) LIMIT
b) TOP
c) FIRST
d) ROWNUM
44. Which command creates a savepoint in a transaction?
a) SAVE TRANSACTION
b) SAVEPOINT
c) CHECKPOINT
d) COMMIT POINT
45. You want to find products whose names start with "Ch". Which operator should you use?
a) =
b) LIKE
c) IN
d) BETWEEN
46. Which type of index allows duplicate values?
a) UNIQUE INDEX
b) PRIMARY INDEX
c) CLUSTERED INDEX
d) NONCLUSTERED INDEX
47. You want to calculate the total sales for each product category. Which clause is essential?
a) WHERE
b) GROUP BY
c) HAVING
d) ORDER BY
48. Which function returns the smallest integer greater than or equal to a number?
a) FLOOR()
b) CEILING()
c) ROUND()
d) INT()
49. You want to ensure that a column does not contain NULL values. Which constraint should you
use?
a) UNIQUE
b) PRIMARY KEY
c) NOT NULL
d) CHECK