BeginnerCoder

Lesson 24 — Views

Views: save a query under a name

A view is a saved SELECT that behaves like a read-only table. You write the complex query once — joins, grouping — and afterwards everyone can simply SELECT from the view. The data is not copied: the view runs its query each time, so it is always up to date.

CREATE VIEW big_orders AS SELECT * FROM orders WHERE total > 100
SELECT * FROM big_orders

Why it matters: views give analysts and apps a simple, stable "table" while the messy details stay in one place.

Want it another way?
Task

Write CREATE VIEW customer_totals AS followed by the given SELECT. The view then stays up to date after a new order.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.

Keep going with Databases & SQL

Ready for more? Optional paid resources that pick up where this lesson leaves off.

Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.