0% found this document useful (0 votes)
3 views28 pages

Using SQL Views

Uploaded by

Patel Saikiran
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)
3 views28 pages

Using SQL Views

Uploaded by

Patel Saikiran
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/ 28

SQL Views

Using SQL Views


Using SQL Views

view
a virtual table whose contents are obtained from an existing table or
tables, called base tables
Using SQL Views

view
a virtual table whose contents are obtained from an existing table or
tables, called base tables

- the retrieval happens through an SQL statement, incorporated into


the view
Using SQL Views
SQL View
Using SQL Views
SQL View
- think of a view object as a view into the base table
Using SQL Views
SQL View
- think of a view object as a view into the base table
- the view itself does not contain any real data; the data is physically
stored in the base table
Using SQL Views
SQL View
- think of a view object as a view into the base table
- the view itself does not contain any real data; the data is physically
stored in the base table
- the view simply shows the data contained in the base table
Using SQL Views
SQL View

CREATE VIEW view_name AS


SELECT
column_1, column_2,… column_n
FROM
table_name;
Using SQL Views
Using SQL Views
Using SQL Views
Using SQL Views
Using SQL Views
Using SQL Views
Using SQL Views

A view acts as a shortcut for writing the same SELECT statement every time a new
request has been made
Using SQL Views
SQL View
- saves a lot of coding time
Using SQL Views
SQL View
- saves a lot of coding time
- occupies no extra memory
Using SQL Views
SQL View
- acts as a dynamic table because it instantly reflects data and
structural changes in the base table
Using SQL Views
SQL View
- acts as a dynamic table because it instantly reflects data and
structural changes in the base table

‘dept_emp’ (table)

emp_no dept_no from_date to_date

10001 d005 1986-06-26 9999-01-01


Using SQL Views
SQL View
- acts as a dynamic table because it instantly reflects data and
structural changes in the base table

‘dept_emp’ (table) ‘dept_emp’ (view)

emp_no dept_no from_date to_date emp_no dept_no from_date to_date

10001 d005 1986-06-26 9999-01-01 10001 d005 1986-06-26 9999-01-01


Using SQL Views
SQL View
- acts as a dynamic table because it instantly reflects data and
structural changes in the base table

‘dept_emp’ (table)

emp_no dept_no from_date to_date

10001 d005 1986-06-26 9999-01-01


Using SQL Views
SQL View
- acts as a dynamic table because it instantly reflects data and
structural changes in the base table

‘dept_emp’ (table)

emp_no dept_no from_date to_date

10001 d005 1986-06-26 2025-06-05


Using SQL Views
SQL View
- acts as a dynamic table because it instantly reflects data and
structural changes in the base table

‘dept_emp’ (table) ‘dept_emp’ (view)

emp_no dept_no from_date to_date emp_no dept_no from_date to_date

10001 d005 1986-06-26 2025-06-05 10001 d005 1986-06-26 9999-01-01


Using SQL Views
SQL View
- acts as a dynamic table because it instantly reflects data and
structural changes in the base table

‘dept_emp’ (table) ‘dept_emp’ (view)

emp_no dept_no from_date to_date emp_no dept_no from_date to_date

10001 d005 1986-06-26 2025-06-05 10001 d005 1986-06-26 2025-06-05


Using SQL Views
SQL Views
Using SQL Views
SQL Views
Don’t forget they are not real, physical data sets, meaning we cannot
insert or update the information that has already been extracted.
Using SQL Views
SQL Views
Don’t forget they are not real, physical data sets, meaning we cannot
insert or update the information that has already been extracted.
- they should be seen as temporary virtual data tables retrieving
information from base tables

You might also like