intermediate

Views

5 min readLast updated: 2026-07-23

Overview

A View is a saved, named SELECT query stored in the database catalog that acts as a virtual table.

Learning Objectives

  • Create logical abstraction layers using CREATE VIEW.
  • Simplify complex queries and restrict sensitive column access.
  • Differentiate standard virtual Views from Materialized Views.

Detailed Concept Explanation

A View does not store physical data itself (unless it is a Materialized View). Whenever you query a View, the database engine executes the underlying SELECT query in real time.

sql
CREATE VIEW active_customers AS
SELECT customer_id, name, email
FROM customers
WHERE status = 'Active';

Code Examples

SQL

sql
-- Querying a View just like a normal table
SELECT * FROM active_customers WHERE name LIKE 'A%';

Summary

Views encapsulate complex SQL logic and restrict access to sensitive fields without duplicating underlying table data.