Views in Relational Databases

 

 Views in Relational Databases

A View is a virtual table in a relational database. It is created using a SQL query and displays data from one or more tables. Unlike a regular table, a view does not store data physically; instead, it stores the query definition and retrieves data dynamically when accessed.

Views are used to simplify complex queries, improve security, and present specific data to users without exposing the entire table.

🔹 Why Use Views?

  • Security – Restrict access to specific columns or rows.

  • Simplification – Hide complex joins and calculations.

  • Data Abstraction – Show only required information to users.

  • Consistency – Provide a standard way to access data.

🔹 Types of Views

  • Simple View – Based on a single table without complex functions.

  • Complex View – Based on multiple tables with joins, grouping, or functions.

🔹 Example (SQL Syntax)

CREATE VIEW student_view AS
SELECT name, department
FROM student;

Comments

Popular posts from this blog

SQL

EMBEDDED SQL