🗃️Database View
Also known as SQL View, View
A saved query you can read from as if it were a table.
Think of it like
Think of it like a window that only shows part of a garden. The garden is the same, you just see less.
Example
Lucy's team keeps asking for this month's paid orders. She saves the query as a view called paid_orders, and everyone uses that.
Why it matters
Views let people use a hard query without writing it. They can also hide private columns.
Definition
Example code
sql
CREATE VIEW rich AS
SELECT name FROM accounts WHERE balance > 60;
SELECT * FROM rich;
-- EmmaCommon mistake
Key takeaways
- 1A saved query. It holds no data itself.
- 2Reads like a table. SELECT works the same way.
- 3Hides the hard part. Joins sit behind one name.