When you start learning SQL, you often hear about Views. Many freshers get confused thinking – Are views like tables? In this blog, we will explain what are views in SQL in very simple words that any beginner in India can understand.
What is a View in SQL?
- A View is like a virtual table.
- It does not store data physically, but shows data from one or more real tables.
- You can think of it as a saved SQL query.
Example:
CREATE VIEW StudentMarks AS
SELECT name, subject, marks
FROM Students
WHERE marks > 60;
Now whenever you use SELECT * FROM StudentMarks;
, it will show only students who scored more than 60.
Why are Views Useful?
- Simplifies Queries – Instead of writing long SQL again and again, you can create a view.
- Security – You can hide sensitive columns (like salary, Aadhaar number) and give access only to a view.
- Reusability – Once created, you can use the same view in multiple queries.
- Easier Understanding – For beginners, views help in breaking complex queries into small parts.
Quick Analogy
Imagine a college report card:
- The main database table = All exam records (with many details).
- The view = Just a report card showing subject, marks, and total. You don’t see all raw details, but only the required summary.
Types of Views
- Simple View – Based on one table.
- Complex View – Based on multiple tables using joins.
- Materialized View (in some databases like Oracle) – Stores data physically for faster access.
Conclusion
- A View in SQL is like a window to your data.
- It doesn’t store data, but shows results from your tables.
- Views make queries simpler, safer, and reusable.
That’s the simple meaning of views in SQL for beginners.