当前位置:网站首页>View analysis

View analysis

2022-06-26 06:19:00 Oh no, less hair

1. An understanding of trying

Views are not real tables , Nor does it really exist in the database , It's a virtual table . My most direct understanding of views is the results of joint queries on a table or multiple tables , Applicable to query , Not applicable for updating , Relative to table , Views have the following advantages :

  1. Simple : View is sql The result returned by executing the query statement , Users do not need to care about the corresponding table structure 、 Association and screening criteria .
  2. Security : Only let the user see the result set that the user needs to see , It can protect some private information .

2. View creation

  1. Single table query creates a view
create view [ View name ]
select [ Name ]
from [ Table name ]
where [ Conditions ]
  1. Multi table joint query to create view
create view [ View name ]
select [ Name ]
from [ surface 1],[ surface 2]
where [ Conditions ]

3. View view

There is no difference between the view and the normal table , It's all about execution select Statement to query

select * from 【 View name 】

4. Modify the view

  1. Use create or replace view sentence
create or replace view 【 View name 】
( Name ) as select 【 Name 】 from 【 Table name 】
  1. Use alter Statement to modify
alter view 【 View name 】 (【 Name 】) 
as select 【 Name 】 from 【 Table name 】

5. Undo view

drop view  【 View name 】
原网站

版权声明
本文为[Oh no, less hair]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260612113081.html