1.Easy
What does a UNIQUE constraint on a column guarantee?
- AThe column automatically becomes the primary key of the table
- BThe column cannot be changed after insert
- CNo two rows have the same non-NULL value in that column
- DThe column values are sorted
2.Easy
Which statement adds a new column to an existing table?
- ACREATE COLUMN
- BUPDATE TABLE
- CALTER TABLE
- DINSERT COLUMN
3.Easy
What does NULL represent in SQL?
- AThe number zero in numeric columns
- BAn empty string
- CA missing or unknown value
- DA false Boolean
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
- BCreate a second copy of the table on disk
- CCombine the table with itself using UNION ALL and a WHERE filter
- DJoin the employees table with itself using two aliases
5.Medium
What does ROLLBACK TO SAVEPOINT s1 do?
- AUndoes the changes made after savepoint s1, keeping the transaction open
- BDeletes the savepoint and all tables changed since then
- CUndoes the whole transaction from the beginning
- DEnds the transaction and commits everything
6.Medium
What is a database trigger?
- AA query that a user runs by hand
- BA type of index that speeds up searches
- CCode that runs automatically when a specified event such as INSERT, UPDATE or DELETE occurs on a table
- DA scheduled backup of the database
7.Hard
When is decomposing R into R1 and R2 guaranteed to be lossless?
- AWhen R1 and R2 have the same number of columns
- BWhen R1 and R2 have no attributes in common
- CWhen the common attributes of R1 and R2 form a superkey of R1 or of R2
- DWhen every attribute of R appears in both R1 and R2
8.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
- Bdept must appear inside an aggregate function
- CCOUNT(*) cannot be used together with GROUP BY
- Dname is neither grouped nor aggregated, so it has no single value per group
Answer key
- 1. C · No two rows have the same non-NULL value in that column
- 2. C · ALTER TABLE
- 3. C · A missing or unknown value
- 4. D · Join the employees table with itself using two aliases
- 5. A · Undoes the changes made after savepoint s1, keeping the transaction open
- 6. C · Code that runs automatically when a specified event such as INSERT, UPDATE or DELETE occurs on a table
- 7. C · When the common attributes of R1 and R2 form a superkey of R1 or of R2
- 8. D · name is neither grouped nor aggregated, so it has no single value per group
Full step-by-step solutions: practise this topic on examproblems.com.