SQL practice: Materialized Views: Caching a Query

Chapter 44 · 5 questions · included in full access

  1. Question 1 · easy

    Create a materialized view named branch_revenue holding branch_id, branch_name and total revenue (quantity times unit_price from order_items) for every branch that has orders.

    Solve it in your browser
  2. Question 2 · easy

    Query the branch_revenue materialized view for branches with revenue above 400000. Show branch_name and revenue, ordered by revenue descending.

    Solve it in your browser
  3. Question 3 · medium

    Create a unique index named branch_revenue_pk on branch_revenue over branch_id, so the view can later be refreshed concurrently.

    Solve it in your browser
  4. Question 4 · hard

    Create a materialized view named product_sales holding product_id, product_name and total units sold, for products that have been sold at least once.

    Solve it in your browser
  5. Question 5 · hard

    Which statement about materialized views is true?

    Solve it in your browser

These questions are part of full access.

The first chapters of every track are free. Full access is a one-time payment.

See pricing