1.Easy
Which SQL statement changes values in rows that already exist?
- AINSERT
- BREPLACE COLUMN
- CMODIFY
- DUPDATE
2.Easy
Which keyword gives a column or table a temporary alternative name in a query?
- AAS
- BALIAS
- CRENAME
- DNAME
3.Easy
Which SQL keyword removes duplicate rows from a result?
- ASINGLE
- BDIFFERENT
- CDISTINCT
- DUNIQUE
4.Medium
Which statement about HAVING is correct?
- AIt must come before WHERE in the SELECT statement
- BIt can use aggregate functions to filter groups
- CIt cannot be used with GROUP BY
- DIt sorts the results
5.Medium
What does EXCEPT (called MINUS in Oracle) return?
- AAll rows from both queries without duplicates
- BRows of the second query that do not appear in the first one
- CRows that appear in both queries
- DRows of the first query that do not appear in the second
6.Medium
An employees table has a column manager_id that refers to another employee. How do you list each employee next to their manager's name?
- AJoin the employees table with itself using two aliases
- BUse GROUP BY manager_id only
- CCreate a second copy of the table on disk
- DCombine the table with itself using UNION ALL and a WHERE filter
7.Hard
Scores are 90, 90 and 80. Which values does RANK() OVER (ORDER BY score DESC) give?
- A1, 1, 2
- B1, 2, 3
- C1, 1, 3
- D2, 2, 3
8.Hard
What does SELECT name, dept, AVG(salary) OVER (PARTITION BY dept) FROM emp return?
- AAn error because name is not in a GROUP BY
- BEvery employee row together with the average salary of their department
- COnly employees who earn more than their department average
- DOne row per department with its average salary
Answer key
- 1. D · UPDATE
- 2. A · AS
- 3. C · DISTINCT
- 4. B · It can use aggregate functions to filter groups
- 5. D · Rows of the first query that do not appear in the second
- 6. A · Join the employees table with itself using two aliases
- 7. C · 1, 1, 3
- 8. B · Every employee row together with the average salary of their department
Full step-by-step solutions: practise this topic on examproblems.com.