Thursday 2 April 2020

VIEW


VIEW is a logical table it contains row and columns of data like a real table. View is used to restrict data access. The fields in a view are fields from one or more real tables in the database.

CREATE VIEW - Create a new view based on existing tables in the database. The table names must already exist. The new view name must not exist. CREATE VIEW has the following syntax:
          CREATE VIEW  AS           ;
 where sql select statement is in the form:
        SELECT
        FROM  
     WHERE
Additional information on the SELECT statement and SQL queries can be found in the next section.
Note that an ORDER BY clause may not be added to the sql select statement when defining a view.
In general, views are read-only. That is, one may query a view but it is normally the case that views can not be operated on with INSERT, UPDATE or DELETE. This is especially true in cases where views joing two or more tables together or when a view contains an aggregate function.
DROP VIEW - Drop a view from the database. The view name must already exist in the database. The syntax for the DROP VIEW command is:
          DROP VIEW  ;

No comments:

Post a Comment