0% found this document useful (0 votes)
9 views1 page

9exp Implementation of Views in SQL

The document outlines the implementation of views in SQL, including how to create, use, and drop views. It provides examples such as creating a view for high-salary employees and a view that joins employee and department data. Additionally, it explains how to create or replace a view with renamed columns.

Uploaded by

gaurav.nullbyte
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

9exp Implementation of Views in SQL

The document outlines the implementation of views in SQL, including how to create, use, and drop views. It provides examples such as creating a view for high-salary employees and a view that joins employee and department data. Additionally, it explains how to create or replace a view with renamed columns.

Uploaded by

gaurav.nullbyte
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Exp 9

Implementation of Views in SQL.

CREATE VIEW view_name AS


SELECT columns
FROM table
WHERE condition;
CREATE VIEW high_salary_emp AS
SELECT name, salary
FROM employee
WHERE salary > 40000;

to Use/View It
SELECT * FROM view_name;

Drop View
DROP VIEW view_name;

Create or Replace a View (Join + Rename)


CREATE OR REPLACE VIEW emp_department_view AS
SELECT
e.empid,
e.name AS employee_name,
e.email,
e.salary,
d.DeptName AS department_name
FROM employee e
JOIN department d ON e.deptid = d.DeptID;

You might also like