1.Easy
What does ROLLBACK do in a transaction?
- AUndoes the changes made since the transaction began
- BRepeats the last statement
- CSaves all changes of the transaction permanently to disk
- DDeletes the table
2.Easy
Which statement adds a new column to an existing table?
- AINSERT COLUMN
- BALTER TABLE
- CUPDATE TABLE
- DCREATE COLUMN
3.Easy
Which aggregate function returns the average of a numeric column?
- AAVG
- BSUM
- CMEAN
- DMEDIAN
4.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?
- AUse GROUP BY manager_id only
- BCombine the table with itself using UNION ALL and a WHERE filter
- CJoin the employees table with itself using two aliases
- DCreate a second copy of the table on disk
5.Medium
Which query returns the highest salary in each department?
- ASELECT dept, MAX(salary) FROM emp ORDER BY dept
- BSELECT MAX(dept), salary FROM emp GROUP BY salary
- CSELECT dept, MAX(salary) FROM emp GROUP BY dept
- DSELECT dept, salary FROM emp WHERE salary = MAX(salary)
6.Medium
In relational algebra, the selection operator (σ) corresponds to which SQL clause?
- ASELECT list
- BORDER BY
- CWHERE
- DGROUP BY
7.Hard
For an equality join between two large tables with no useful indexes, which join algorithm does an optimiser often choose?
- ANested loop join with index lookups
- BBitmap join on the primary key
- CCross join
- DHash join
8.Hard
What does a FULL OUTER JOIN return?
- AAll rows from both tables, matched where possible and NULL-filled otherwise
- BOnly matching rows
- CThe Cartesian product, pairing each row of one table with every row of the other
- DOnly unmatched rows
Answer key
- 1. A · Undoes the changes made since the transaction began
- 2. B · ALTER TABLE
- 3. A · AVG
- 4. C · Join the employees table with itself using two aliases
- 5. C · SELECT dept, MAX(salary) FROM emp GROUP BY dept
- 6. C · WHERE
- 7. D · Hash join
- 8. A · All rows from both tables, matched where possible and NULL-filled otherwise
Full step-by-step solutions: practise this topic on examproblems.com.