Home »
SQL
SQL - VIEW AND DUAL
SQL - VIEW SQL - DUAL: Here, we will learn what is VIEW, how to create VIEW and how it reflects on the tables?
Submitted by Shubham Singh Rajawat, on November 14, 2017
A VIEW is a virtual table, through wish we can select a small portion of data from one or more table, and it restricts the access on the original table/data. Any changes done on data in view will reflect on the tables from which data is taken.
A DUAL is a special one column and one row which can be used to do small calculations and operations etc.
Sample table (Student),
Examples:
1) Create a view from the student table
CREATE VIEW first_view AS SELECT student_name, City from Student;
To view this table we need to use SELECT query.
SELECT * FROM first_view;
Here, first_view : it is the name of the virtual table
2) Use DUAL to get current date
SELECT SYSDATE() FROM DUAL;
Will return current date from the system.