Structured Query Language (SQL) MCQs

Topic-wise practice questions for Database Management Systems. Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q11medium
Trace the output of this update operation. How many rows are affected? postgres - update_test

-- Table: score(id, val)
-- (1, 10), (2, 20), (3, 30), (4, 40)
Q12medium
If a table has 100 rows and you execute SELECT DISTINCT country FROM Users;, and 40 users are from 'USA', 40 are from 'UK', and 20 are from 'Germany', how many rows are in the result?
Q13medium
A marketing database contains a Customers table. You need to find all customers whose names start with 'S' and end with 'n' (e.g., 'Steven', 'Susan'). Which WHERE clause is correct?
Q14easy
What is the result of SELECT AVG(val) FROM T; if table T has

values: 10, 20, NULL, 30?
Q15easy
The AS keyword in SQL is primarily used for:
Q16medium
You need to sort a list of students by grade (highest first) and then by last_name alphabetically for students with the same grade. Which clause is correct?
Q17medium
A table Survey has a column feedback. There are 10 rows total: 7 rows have text comments, and 3 rows have NULL values. What will be the result of SELECT

COUNT(feedback) FROM Survey;?
Q18medium
An HR database needs to delete all employees who belong to the 'Temporary' department. Which statement is correct?
Q19easy
Observe the following logical conditions in a WHERE clause. Which rows will be returned?
Q20medium
You need to add a new employee to the database, but you only know their name and department. The salary should be left for later. Which SQL syntax is correct?