Database study notes (eight, view management)

The view is a virtual table whose content is defined by the query. Like a real table, the view contains a series of named column and row data. The data change of the view will affect the base table, and the data change of the base table will also affect the view.
1. Create a view

create view 视图名 as select语句;

2. Delete the view

drop view 视图名;

3. View rules and restrictions

  • Like the table, it must be uniquely named (a view or table name with the same name cannot appear);
  • There is no limit to the number of views created, but the performance impact of complex queries after being created as views must be considered;
  • Views cannot add indexes, nor can they have associated triggers or default values;
  • Views can improve security and must have sufficient access rights;
  • Order by can be used in the view, but if the select also contains order by in the data retrieved from the view, then the order by in the view will be overwritten;
  • Views can be used with tables;

Guess you like

Origin blog.51cto.com/14289397/2545143