12 Sep 100 SQL MCQ (Multiple Choice Questions) with Answers
Show Answer
2) Which SQL clause is used to filter records?
Show Answer
3) Which keyword is used to sort the result set in ascending order by default?
Show Answer
4) How do you select all columns from a table named `Users`?
Show Answer
5) Which SQL operator is used to search for a specified pattern in a column?
Show Answer
6) Which function returns the total number of rows in a table?
Show Answer
7) Which command is used to remove all records from a table without removing the table structure?
Show Answer
8) Which constraint ensures that all values in a column are unique?
Show Answer
9) Which SQL clause is used to aggregate data by one or more columns?
Show Answer
10) Which clause is used to filter groups created by `GROUP BY`?
Show Answer
11) What type of JOIN returns records that have matching values in both tables?
Show Answer
12) Which statement is used to insert new data into a database?
Show Answer
13) Which command completely deletes a table and its structure from the database?
Show Answer
14) Which wildcard character represents zero or more characters in SQL `LIKE` queries?
Show Answer
15) Which wildcard character represents a single character in standard SQL `LIKE` queries?
Show Answer
16) Which SQL keyword is used to modify existing records in a table?
Show Answer
17) What does `NULL` represent in SQL?
Show Answer
18) Which statement is used to create a new database?
Show Answer
19) Which constraint uniquely identifies each record in a database table?
Show Answer
20) Which command saves pending transaction changes permanently to the database?
Show Answer
21) Which function returns the largest value in a selected column?
Show Answer
22) Which function returns the average value of a numeric column?
Show Answer
23) Which clause is used to limit the number of rows returned in MySQL or PostgreSQL?
Show Answer
24) What type of key links two tables together in a relational database?
Show Answer
25) Which SQL operator allows you to specify multiple values in a `WHERE` clause?
Show Answer
26) Which SQL operator is used to select values within an inclusive range?
Show Answer
27) Which keyword is used to return only distinct (unique) values?
Show Answer
28) What type of JOIN returns all rows from the left table, and matching rows from the right table?
Show Answer
29) What is the default sort order of the `ORDER BY` clause?
Show Answer
30) Which SQL language sub-category includes `SELECT`, `INSERT`, `UPDATE`, and `DELETE`?
Show Answer
31) Which SQL sub-category includes `CREATE`, `ALTER`, and `DROP`?
Show Answer
32) Which SQL command undoes uncommitted transactions?
Show Answer
33) Which SQL operator combines the result sets of two queries and removes duplicates?
Show Answer
34) Which operator combines the result sets of two queries including all duplicates?
Show Answer
35) Which constraint limits the value range that can be placed in a column?
Show Answer
36) Which keyword is used to add a new column to an existing table?
Show Answer
37) How do you rename a column in an existing table?
Show Answer
38) What type of JOIN returns all records when there is a match in either left or right table?
Show Answer
39) A Cartesian product is produced by which type of JOIN?
Show Answer
40) Which command grants privileges to users in a database?
Show Answer
41) Which command revokes privileges previously granted to users?
Show Answer
42) Which aggregate function returns the total sum of a numeric column?
Show Answer
43) Which function returns the smallest value of a selected column?
Show Answer
44) What does the `IS NULL` operator check for?
Show Answer
45) Which clause is evaluated FIRST in standard SQL query execution order?
Show Answer
46) Which clause is evaluated LAST in standard SQL query execution order?
Show Answer
47) What statement creates a virtual table based on the result-set of an SQL statement?
Show Answer
48) What database object is used to speed up data retrieval performance?
Show Answer
49) How do you delete all data from a table named `Logs` using DML?
Show Answer
50) Which operator tests whether a subquery returns any rows?
Show Answer
51) Which statement drops an existing view?
Show Answer
52) What type of JOIN joins a table to itself?
Show Answer
53) What constraint automatically assigns a value to a column when no value is specified?
Show Answer
54) Which keyword is used to remove a primary key constraint from a table?
Show Answer
55) In SQL, what is a subquery?
Show Answer
56) Which operator returns TRUE if ALL subquery values meet the condition?
Show Answer
57) Which function converts a string to uppercase in standard SQL?
Show Answer
58) Which scalar function removes leading and trailing spaces from a string?
Show Answer
59) Which function returns the current system date and time in SQL Server?
Show Answer
60) Which statement is used to execute a stored procedure in SQL Server?
Show Answer
61) What automatically executes in response to certain events on a table?
Show Answer
62) Which normalization level eliminates repeating groups?
Show Answer
63) Which normalization form requires removing transitive dependencies?
Show Answer
64) A primary key composed of two or more columns is known as a:
Show Answer
65) Which command permanently deletes a database?
Show Answer
66) Which set operator returns only rows common to both query results?
Show Answer
67) Which SQL keyword replaces `INTERSECT` for set difference in Oracle?
Show Answer
68) Which function replaces NULL values with a specified replacement value?
Show Answer
69) What will `COALESCE(NULL, NULL, ‘SQL’, ‘Python’)` return?
Show Answer
70) Which constraint prevents `NULL` values from being inserted into a column?
Show Answer
71) What does the `ROLLBACK` command do?
Show Answer
72) Which clause assigns an alias to a column or table?
Show Answer
73) What is the result of `10 / NULL` in SQL?
Show Answer
74) Which conditional expression acts like an IF-THEN-ELSE statement in SQL?
Show Answer
75) What command removes an index from a database?
Show Answer
76) Which function is used to calculate string length in SQL Server?
Show Answer
77) What type of lock allows multiple transactions to read a resource simultaneously?
Show Answer
78) Which window function assigns a unique sequential integer to rows starting at 1?
Show Answer
79) What is the difference between `RANK()` and `DENSE_RANK()` upon encountering ties?
Show Answer
80) Which clause is required when using window functions like `ROW_NUMBER()`?
Show Answer
81) Which window function partitions the rows into a specified number of equal groups?
Show Answer
82) Which function accesses data from a previous row in the same result set without using a self-join?
Show Answer
83) Which function accesses data from a subsequent row in the same result set?
Show Answer
84) What property in ACID guarantees that all operations within a transaction complete successfully or fail completely?
Show Answer
85) What property in ACID ensures committed data is saved even during a system crash?
Show Answer
86) A query reading uncommitted data from another concurrent transaction experiences a:
Show Answer
87) Which isolation level completely prevents Dirty Reads, Non-repeatable Reads, and Phantom Reads?
Show Answer
88) What does CTE stand for in SQL?
Show Answer
89) Which clause is used to define a Common Table Expression (CTE)?
Show Answer
90) Which join type returns all rows from both tables, filling missing matches with NULLs?
Show Answer
91) What type of command is `SAVEPOINT`?
Show Answer
92) How do you delete duplicate rows while retaining one copy in SQL?
Show Answer
93) What is the default index type created on a Primary Key in SQL Server?
Show Answer
94) How many clustered indexes can exist on a single table?
Show Answer
95) What is the key characteristic of a clustered index?
Show Answer
96) Which keyword prevents a transaction from locking an entire table when reading data in SELECT statements?
Show Answer
97) What is an inline table-valued function?
Show Answer
98) What happens to a foreign key constraint by default if you attempt to delete a referenced row in a parent table?
Show Answer
99) Which option on a foreign key constraint causes matching child rows to be deleted automatically when a parent row is deleted?
Show Answer
100) What SQL feature allows writing recursive queries for hierarchical data structures?
Show Answer
No Comments