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