IntermediateCombining data
Views
Save a query under a name and use it like a table.
SQLIntermediate7 min read
Recommended first
By the end of this lesson you will be able to:
- Create a view from a query
- Query a view like a table
- Explain why views aid clarity and reuse
A view is a saved query with a name. It stores no data of its own — it's a stored definition that runs whenever you query it, always reflecting the current data. Think of it as a named, reusable building block.
Creating and using a view
Define the "order with customer name" join once, then query it as if it were a table:
SQL — editable, runs in your browser
The view hides the join behind a friendly name. Anyone can SELECT … FROM order_summary without re-writing (or even understanding) the join.
Why views help
- Reuse — write a complex join or aggregation once, query it everywhere.
- Clarity — callers work with a clean, named abstraction (the interfaces idea from the fundamentals track, applied to data).
- Consistency — everyone computes "an order summary" the same way.
Views are read-through: query one and you always see live data. (Materialized views, which do cache results, are an advanced, engine-specific feature.)
Where to go next
That completes Combining data. The module lab puts joins, subqueries, and grouping together on the shop.
Finished reading? Mark it complete to track your progress.