Junior SQL

What is a View in SQL?

A view in SQL is a virtual table that is defined by a SELECT query. It does not store data

itself but rather provides a way to view and work with the results of a query as if it were a

table. Views allow users to access specific, formatted data without modifying the underlying

tables directly.

  • Purpose: Simplify complex queries, abstract the database schema, and improve

security by exposing only the necessary data.

Example:

CREATE VIEW employee_view AS

SELECT id, name, department

FROM employees;

You can then query the view like a regular table:

SELECT * FROM employee_view;

More from SQL Server Tutorial

All questions for this course