Database Security and Authorization - integrity constraints, check constraints, referential constraints, views and updates on views - Question Bank
1. When updating data through a view that involves a join, if the update affects columns from multiple base tables, what is a common requirement for the view to be updatable?
2. Which of the following is a common way to implement authorization in a database system?
3. What does it mean to grant `ALL PRIVILEGES` on a table to a user?
4. If a user has `UPDATE` privilege on a table but not `INSERT` privilege, they can:
5. Which privilege allows a user to remove rows from a table?
6. Which privilege allows a user to modify existing data in a table?
7. A user having `INSERT` privilege on a table can:
8. A user having `SELECT` privilege on a table can:
9. Which SQL command is used to remove privileges from a user?
10. Which SQL command is used to grant specific privileges to a user?
11. What is the fundamental role of authorization in database security?
12. Which of the following scenarios would typically prevent a view from being updatable?
13. If a view is defined using an aggregate function like `COUNT(*)`, can it be updated?
14. A `CHECK` constraint can be used to enforce:
15. What is the purpose of defining `ON DELETE SET NULL` for a foreign key?
16. Which of the following actions is typically restricted by a referential constraint when attempting to delete a record from the parent table?
17. Consider a view `ProductSummary` created from `Products` and `Categories` tables. If `ProductSummary` includes columns from both tables, and an update is attempted on a column that exists only in the `Products` table, the update is:
18. What is the main difference between a PRIMARY KEY constraint and a UNIQUE constraint?
19. A constraint that ensures that no two rows in a table have the same value in a specified column (or set of columns) is a:
20. Which integrity constraint enforces entity integrity?
21. If a view is defined as `CREATE VIEW HighSalaryEmployees AS SELECT EmployeeID, Name FROM Employees WHERE Salary > 100000;`, can `EmployeeID` be updated through this view?
22. Which of the following SQL statements would create a view named `ActiveCustomers` showing customers from the `Customers` table whose `status` is 'Active'?
23. A database designer wants to ensure that every `order_id` entered into the `Orders` table must correspond to an existing `customer_id` in the `Customers` table. Which constraint should be used?
24. What is the purpose of the `NOT NULL` constraint?
25. If a `FOREIGN KEY` constraint is defined with `ON DELETE RESTRICT`, what happens if you try to delete a row from the parent table that has related rows in the child table?
26. Consider a table `Employees` with columns `EmployeeID` (PK), `Name`, `DepartmentID` (FK referencing `Departments.DepartmentID`), and `Salary`. Which of the following is a valid CHECK constraint for the `Salary` column?
27. Which of the following statements about updating views is TRUE?
28. When a view is based on a single table, and the update operation modifies a column that is part of the view's selection, what is the most likely outcome?
29. What is the primary benefit of using CHECK constraints?
30. A database constraint that prevents inserting a value into a column if that value is not present in a specified list of allowed values is a type of:
31. Which of the following is NOT a type of integrity constraint?
32. The `ON UPDATE SET NULL` option for a foreign key constraint means:
33. What does the `ON DELETE CASCADE` option in a foreign key constraint do?
34. If a view is created using a JOIN operation, under what condition might it be updatable?
35. Which type of view is generally updatable?
36. What is a potential issue when updating data through a view?
37. Can you perform an INSERT operation directly on a view?
38. What is a primary advantage of using views?
39. A view in a database is best described as:
40. Which SQL clause is used to define a check constraint?
41. What operation is typically forbidden on a referenced primary key if there are referencing foreign keys?
42. The table containing the referenced column in a referential constraint is called the:
43. In a referential constraint, the table containing the referencing column is known as the:
44. What does a referential constraint ensure between two tables?
45. A referential constraint is typically implemented using which database object?
46. Which of the following is an example of a check constraint condition?
47. A constraint that restricts the values that can be entered into a column based on a specific condition is called a:
48. What is the primary purpose of an integrity constraint in a database?
49. Which type of constraint ensures that all values in a column are unique?