CREATING VIEWS:
Views are virtual tables which are created from other tables .It is beneficial for those situation when we want to show limited columns to users. It can be created from one or more tables.
Syntax:
CREATE VIEW viewname AS SELECT column1, column2,.... columnN FROM tablename WHERE (condition);
Example:
CREATE VIEW EmpVIEW AS SELECT name FROM EMPLOYEE;
This will be the Ouput for this query:
Name |
------------ |
Michael |
Joseph |
John |
As we can see from the output the above query will create a view EmpVIEW which will contain only Employee name column, so other columns of Employee table will not show in it. EmpVIEW will only contain name column only.
0 Comment(s)