1.Easy
How do you sort a result from the highest to the lowest salary?
- ASORT salary DOWN
- BGROUP BY salary DESC
- CORDER BY salary DESC
- DORDER BY salary ASC
2.Easy
Which aggregate function returns the average of a numeric column?
- AMEAN
- BSUM
- CMEDIAN
- DAVG
3.Easy
Which operator is used for simple text pattern matching in a WHERE clause?
- ACONTAINS
- BMATCH
- CSIMILAR
- DLIKE
4.Medium
What does ROLLBACK TO SAVEPOINT s1 do?
- ADeletes the savepoint and all tables changed since then
- BUndoes the changes made after savepoint s1, keeping the transaction open
- CUndoes the whole transaction from the beginning
- DEnds the transaction and commits everything
5.Medium
What is SQL injection?
- AAn attack where user input changes the structure of a SQL query
- BA way to add indexes
- CA database backup technique
- DA technique for inserting many rows quickly with a single INSERT statement
6.Medium
Which ACID property guarantees that committed changes survive a system crash?
- AAtomicity
- BIsolation
- CDurability
- DConsistency
7.Hard
Why is SELECT dept, name, COUNT(*) FROM emp GROUP BY dept invalid in standard SQL?
- AGROUP BY must list all columns of the table
- BCOUNT(*) cannot be used together with GROUP BY
- Cdept must appear inside an aggregate function
- Dname is neither grouped nor aggregated, so it has no single value per group
8.Hard
x is NULL and y = 1. What is the value of the condition (x > 5 OR y = 1)?
- AUNKNOWN
- BTRUE
- CFALSE
- DNULL, so the row is always rejected
Answer key
- 1. C · ORDER BY salary DESC
- 2. D · AVG
- 3. D · LIKE
- 4. B · Undoes the changes made after savepoint s1, keeping the transaction open
- 5. A · An attack where user input changes the structure of a SQL query
- 6. C · Durability
- 7. D · name is neither grouped nor aggregated, so it has no single value per group
- 8. B · TRUE
Full step-by-step solutions: practise this topic on examproblems.com.