>_ IzzyLab

Topic breakdown

A view (VIEW) is a query saved in the database that you access like an ordinary table. Unlike a materialized one, it stores no data: on each access Postgres re-runs the underlying SELECT, which is handy for hiding complex logic behind a simple name. Inside such a view usually lives an aggregating query with JOIN and GROUP BY; an ordinary join by itself cuts off records without a match, so no extra filter is needed for that. The result column names are set as aliases via AS, otherwise the aggregate gets an auto-generated name.

What's checked

  1. view customer_totals created
  2. VIEW returns correct totals
  3. the VIEW has only customers with orders

What it looks like