i): Definition of view
A view is a virtual table defined by a query based on one or more tables, which saves the specific definition of the query, and the view contains no data.
The view has no difference in operation from the datasheet, but the difference is in its nature. A datasheet is where the record is actually stored, whereas the view does not hold any records, it is actually a query statement.
The same data table, depending on the different needs of different users, you can create different views.
II): The role of the view
1): Filter the rows in the table
2): Prevent unauthorized users from accessing sensitive data
3): Reduce the complexity of the database
4): To abstract multiple physical data into a logical database
III): Create a View instance
Copy Code code as follows:
Create View view_officeinfo--(view name)
As (select A.name as property name, B.a_name as City, C.a_name as area, d.a_name as street from dbo. Office_info as A
INNER JOIN dbo. Base_area as B on a.cityid=b.a_id
INNER JOIN dbo. Base_area as C on a.areaid=c.a_id
INNER JOIN dbo. Base_area as D on a.streetid=d.a_id)--(SQL statement)
SELECT * from View_officeinfo (view name)
IV): Delete Modify View
Delete:
Copy Code code as follows:
if exists (SELECT * from sys.objects where name= ' View_officeinfo ')
Drop View_officeinfo
Modify:
Copy Code code as follows:
ALTER VIEW v_student as SQL statement