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