PRACTICE • LEARN • GROW
Module 5 Final Quiz: SQL Fundamentals MCQs
Solve topic-wise placement questions and improve your skills.
Module 5 Final Quiz: SQL Fundamentals Progress
0 of 11 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
To which SQL sublanguage do the commands CREATE, ALTER, DROP, and TRUNCATE belong?
A.
Data Manipulation Language (DML)
B.
Data Definition Language (DDL)
C.
Data Control Language (DCL)
D.
Transaction Control Language (TCL)
Explanation & Key
Correct Answer:
2
What is the crucial performance and logging difference between DELETE and TRUNCATE?
A.
DELETE drops the table structure; TRUNCATE does not
B.
DELETE is a DML statement that logs every individual row deletion (slower, can use WHERE); TRUNCATE is DDL that deallocates entire data pages at once (much faster, cannot use WHERE)
C.
TRUNCATE is slower than DELETE
D.
DELETE resets the table AUTO_INCREMENT counter; TRUNCATE does not
Explanation & Key
Correct Answer:
3
What is the true Logical Execution Order of clauses in an SQL SELECT query?
A.
SELECT -> FROM -> WHERE -> GROUP BY -> HAVING -> ORDER BY
B.
FROM -> WHERE -> GROUP BY -> HAVING -> SELECT -> DISTINCT -> ORDER BY -> LIMIT
C.
WHERE -> FROM -> SELECT -> ORDER BY -> GROUP BY
D.
SELECT -> ORDER BY -> FROM -> WHERE
Explanation & Key
Correct Answer:
4
Why does the query 'SELECT salary * 12 AS annual_sal FROM Employees WHERE annual_sal > 50000;' fail in SQL?
A.
Because SQL cannot multiply numbers
B.
Because the WHERE clause is evaluated BEFORE the SELECT clause, so the alias 'annual_sal' does not yet exist when WHERE runs
C.
Because AS is an invalid keyword in SQL
D.
Because annual salaries must be integers
Explanation & Key
Correct Answer:
5
How do you test for a NULL value in an SQL WHERE clause?
A.
WHERE column_name = NULL
B.
WHERE column_name IS NULL
C.
WHERE column_name == NULL
D.
WHERE column_name IN (NULL)
Explanation & Key
Correct Answer:
6
In the SQL LIKE operator, what do the '%' and '_' wildcard symbols represent respectively?
A.
'%' matches exactly one character; '_' matches zero or more characters
B.
'%' matches zero, one, or multiple characters; '_' matches exactly one single character
C.
'%' matches numbers only; '_' matches letters only
D.
'%' is division; '_' is an escape character
Explanation & Key
Correct Answer:
7
What is the difference between COUNT(*) and COUNT(column_name)?
A.
COUNT(*) only counts primary keys; COUNT(column_name) counts foreign keys
B.
COUNT(*) counts all rows in the table/group including rows containing NULLs; COUNT(column_name) counts only rows where the specified column is NOT NULL
C.
COUNT(*) is slower than COUNT(column_name)
D.
There is no difference; they produce identical results in all scenarios
Explanation & Key
Correct Answer:
8
What is the key difference between the WHERE clause and the HAVING clause in SQL?
A.
WHERE is used for numbers; HAVING is used for strings
B.
WHERE filters raw individual rows BEFORE grouping; HAVING filters aggregated groups AFTER GROUP BY (and can evaluate aggregate functions like AVG or COUNT)
C.
HAVING runs before WHERE
D.
WHERE can only be used with SELECT; HAVING can only be used with INSERT
Explanation & Key
Correct Answer:
9
What does the SQL command COMMIT do in Transaction Control Language (TCL)?
A.
Deletes all tables in the database
B.
Permanently saves all changes made during the current transaction to non-volatile storage and releases locks
C.
Undoes all operations back to the beginning of the script
D.
Creates a backup archive on an external disk
Explanation & Key
Correct Answer:
10
What does the command 'GRANT SELECT, INSERT ON Employees TO user_alex;' represent?
A.
DDL statement
B.
DCL (Data Control Language) statement managing user privileges
C.
DML statement
D.
TCL statement
Explanation & Key
Correct Answer:
11
Which of the following queries correctly retrieves the top 3 highest earning employees in standard SQL (PostgreSQL/MySQL)?
A.
SELECT * FROM Employees WHERE MAX(salary) LIMIT 3;
B.
SELECT * FROM Employees ORDER BY salary DESC LIMIT 3;
C.
SELECT TOP 3 * FROM Employees GROUP BY salary;
D.
SELECT * FROM Employees HAVING salary > 3;
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong