Discussion Questions Week 6
1. What is a view in a database, and what is its purpose?
2. How do views help in database security?
3. How can views be updated in a database, and what are the implications of updating a
view?
4. What is the difference between an updatable and non-updatable view?
5. How can views be used to improve database performance?
6. What are materialized views, and how do they differ from regular views?
7. How can views be used to implement a logical data model in a database?
Practice Questions
1. Assume you have a database with a table named "orders" that contains information
about customer orders, including order id, customer id, product id, order date, and
order status. You want to create a view that only shows orders placed in the last 30
days. Write a SQL query to create this view.
2. Consider the following table in a database:
SALES (product_id, product_name, product_category, unit_price, quantity,
sale_date)
Write a view that displays the total sales revenue for each product category.