MCQ ch7
MCQ ch7
**Which of the following SQL features allow users to specify more complex retrievals from a
database?**
- A) Nested queries
- B) Joined tables
- C) Aggregate functions
- D) All of the above
- **Answer: D**
6. **Which comparison operator can be used with sets or multisets in nested queries?**
- A) IN
- B) ANY
- C) SOME
- D) All of the above
- **Answer: D**
7. **What does the operator `= ANY` (or `= SOME`) return when used in a query?**
- A) TRUE if the value is equal to all values in the set
- B) TRUE if the value is equal to some value in the set
- C) TRUE if the value is not in the set
- D) FALSE if the value is in the set
- **Answer: B**
15. **What is the main advantage of the query modification approach for view
implementation?**
- A) Efficiency in querying
- B) Simplicity in updating
- C) Avoiding storage of view tables
- D) Reducing query execution time
- **Answer: C**
17. **Which strategy for view materialization updates the view immediately after the base
tables change?**
- A) Immediate update strategy
- B) Lazy update strategy
- C) Periodic update strategy
- D) On-demand update strategy
- **Answer: A**
18. **Which statement is true about updating views?**
- A) All views can be updated directly
- B) Views with joins can always be updated
- C) Views without aggregate functions and with a single base table can often be updated
- D) No views can be updated
- **Answer: C**
19. **What does the clause WITH CHECK OPTION ensure in a view definition?**
- A) That tuples being updated stay in the view
- B) That the view is always materialized
- C) That the view is automatically updated
- D) That the view is deleted when not needed
- **Answer: A**
26. **Which of the following SQL features can be used to hide certain attributes from
unauthorized users?**
- A) Assertions
- B) Triggers
- C) Views
- D) Indexes
- **Answer: C**
28. **In the context of SQL views, what does the term "inline view" refer to?**
- A) A view that is defined within the FROM clause of a query
- B) A view that is permanently stored in the database
- C) A view that is updated immediately after changes
- D) A view that cannot be updated
- **Answer: A**
30. **Which of the following is an example of a semantic constraint that can be specified as an
assertion in SQL?**
- A) NOT NULL constraint
- B) UNIQUE constraint
- C) A complex condition involving multiple attributes and tables
- D) Primary key constraint
- **Answer: C**
31. **How can complex conditions that go beyond simple attribute and domain checks be
enforced in SQL?**
- A) Using primary keys
- B) Using foreign keys
- C) Using assertions
- D) Using indexes
- **Answer: C
**
33. **Which clause can be used to filter rows in the results of an SQL query?**
- A) SELECT
- B) WHERE
- C) FROM
- D) GROUP BY
- **Answer: B**
37. **Which SQL feature allows the definition of a virtual table based on a query?**
- A) Trigger
- B) Assertion
- C) View
- D) Index
- **Answer: C**
44. **Which clause can be used to specify the columns of a table that should be indexed?**
- A) SELECT
- B) INDEX
- C) CREATE INDEX
- D) ALTER INDEX
- **Answer: C**
45. **What is the purpose of the CASCADE option in the DROP TABLE command?**
- A) To drop the table only if it is empty
- B) To drop the table and all objects that depend on it
- C) To drop the table if it has no foreign keys
- D) To rename the table
- **Answer: B**
50. **How can you ensure that an attribute in an SQL table must always have a value?**
- A) By defining it as a primary key
- B) By using the NOT NULL constraint
- C) By defining it as a foreign key
- D) By creating an index on the attribute
- **Answer: B**
These questions cover various aspects of SQL queries, triggers, views, and schema
modifications as discussed in the provided text.