AvailableIncluded in beta access

Micro-course · Intermediate

Create views and materialized views

Reuse query logic and decide when its result should be materialized.

60 to 75 minCommon SQL · PostgreSQL5 lessons · 7 activities available
Start the course

Free 30-day beta access · no payment · progress saved

The business problem

Several reports calculate the same monthly metric differently.

What you will be able to do

Create a view, explain its limits and refresh a PostgreSQL materialized view.

  • Create a view
  • Choose a view or CTE
  • Understand materialization
  • Plan a refresh

Scope of this micro-course

This micro-course targets one focused skill. It does not replace a complete path or server administration training.

Prerequisites

  • SELECT, JOIN and aggregations

Project and practice

7 verified exercises are available. Validation is based on the programme exercises.

Focused path

Your programme, in order.

Content remains centralised: completing an activity here also updates the path that contains it.

Micro-lessons

  1. 01
    A CTE gives a name to a reasoning step

    The WITH clause allows you to define several intermediate results. A first CTE can aggregate monthly sales, a second calculate the margin, then the final query classifies the periods.

    Open lesson
  2. 02
    A reusable method

    A good query is built in short steps. Run the source first, add a transformation, observe the result, then only the next clause.

    Open lesson
  3. 03
    The problem to solve before syntax

    The same KPI copied into five reports ends up diverging. A view centralizes the logic; a materialized view can speed up expensive computation but introduces a freshness lag.

    Open lesson
  4. 04
    Build a controllable method

    Use a view to encapsulate a query without storing its result. Use a materialized view when the cost justifies a stored result and a refresh policy is acceptable.

    Open lesson
  5. 05
    Check before interpreting

    Document level of detail, ownership, dependencies and freshness. Verify rights to underlying objects and measure gain before materializing.

    Open lesson

Practical exercises

  1. 01
    Create and maintain reliable views

    Check the nature and definition of the objects, not just a few rows returned.

    Do exercise
  2. 02
    Create a reusable billing view 2 training scenario

    Centralize a definition of active data without copying the query. You must produce the result, check it on the source data and explain what it allows you to decide in this billing system.

    Do exercise
  3. 03
    Create a reusable logistics view 3 training scenario

    Centralize a definition of active data without copying the query. You must produce the result, check it on the source data and explain what it allows you to decide in this national expeditions.

    Do exercise
  4. 04
    Create a reusable HR 4 view · training scenario

    Centralize a definition of active data without copying the query. You must produce the result, control it on the source data and explain what it allows you to decide in this human resources management.

    Do exercise
  5. 05
    Create a reusable view audit 5 training scenario

    Centralize a definition of active data without copying the query. You must produce the result, check it on the source data and explain what it allows you to decide in this audit log.

    Do exercise
  6. 06
    Segment customers with a CTE

    Calculate the total per customer, then transform this result into a business segment.

    Do exercise
  7. 07
    Rank the top three categories

    Prepare a reliable aggregate before limiting the ranking.

    Do exercise

Back to the full catalogue