Views
A view is a saved query that behaves like a table. It stores no data of its own: each time you read it, the underlying query runs. Views are useful to:
- give a complicated join a simple name;
- show a user only some columns (hide salary, show name);
- keep one agreed definition (what counts as "active customer") in one place.
Create one with CREATE VIEW name AS SELECT ... and query it like any table.
Examplepython
Quick check
Does a view store its own copy of the data?
Your turn: write the code
Create a view cheap of products priced under 20 and print the names from it, ordered by name.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.