What is a view (VIEW) in SQL?
A view (VIEW) is a virtual table created from an SQL query's result.
It doesn't store data physically, instead it runs the specified query against the source tables every time it's accessed.
Example
sql
CREATE VIEW active_users AS
SELECT id, name, email
FROM users
WHERE is_active = 1;Now you can use it like a regular table:
sql
SELECT * FROM active_users;Advantages
- simplifies complex queries,
- hides unnecessary fields (improving security),
- helps keep the data structure clean.
Essentially, a VIEW is a saved SELECT that makes working with data more convenient and clear.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.