Home / code / sql

View

CREATE VIEW

CREATE VIEW viewname (column1, column2, ...) AS select-instruction

A view is a select-instruction that is saved. If you want to show data from the view, the select-instruction is used again. You can add and change data, the data in the tables are then changed.

CREATE VIEW topten (country, cityname, population) AS SELECT top 10 FROM cities ORDER BY population DECs
This makes a view that selects a list of the 10 cities with the biggest population.

DROP VIEW

Removes the view from the database.

DROP VIEW viewname

DROP VIEW topten
Removes the view topten from the database.

 

TOP

Latest script:

 

Books: