As your database grows, you'll want to stop repeating yourself. Instead of rewriting the same query or the same logic over and over, you can save it inside PostgreSQL and reuse it. This module covers the main tools for doing that.
You'll start with views and materialized views, which save a query so you can treat its result like a table. Then you'll write functions and stored procedures to package logic you can call whenever you need it, and learn how the two differ. Finally, you'll use triggers to run a function automatically when data is inserted, updated, or deleted.
With these tools you'll be ready for the next module, Security & Administration, where you learn how to control who can do what in your database.
A short tutorial explaining what views and materialized views are in Postgres, how they differ, and how to create each one.
A look at functions in PostgreSQL, a powerful feature for data manipulation and business logic. Learn how to create, call, and manage them.
A deeper look at stored procedures in PostgreSQL, including how they differ from functions and when to use each one.