A View is a virtual or imaginary table based on the outcome of a SELECT statement.A View is a virtual or imaginary table based on the outcome of a SELECT statement.
A View is a virtual or imaginary table based on the outcome of a SELECT statement. A view include rows and columns as real table. A view include a fields is similar to one or more real tables in database. A view of a table does not store a data.
Understand with Example
The Tutorial illustrate an example from 'View in SQL'. To understand this example we create a table 'customer'. The create table is used to create a table customer with required field attribute and data type respectively.
Create Table 'customer':
|create table customer(First_Name varchar(15),Last_Name varchar(15),Address varchar(15),City varchar(15),Country varchar(15));
Insert values into Table 'customer':
The insert into add the records or rows to the table 'customer'.
To see the detail of table 'customer':
The Select keywords returns you the set of records from table 'customer'.
|select * from customer;|
Create View 'viewCustomer':
Now we apply view on Table 'customer'. The create VIEW is used to create a view 'viewCustomer' that contain the first_name,last_name and country field name from table 'customer',
|create VIEW viewCustomer as SELECT First_Name,Last_Name,Country
View Details :
The select return the set of records or rows from 'viewCustomer'.
|select * from viewCustomer;|
Output is displayed as :