A view is a common database object that stores query results in a virtual table. The view has many advantages: 1. It can simplify operations, 2. It can set up front-end and back-end buffering, 3. It can combine and split data, 4, the most important thing is to improve security. Therefore, visual charts also occupy a very important position in SQL. In the summary of this chapter, I deeply realized that two methods: 1, Enterprise Manager, 2, T-SQL statements to manage the view, and four operations: 1, add, 2 ,, delete, 3, modify, 4, query.
In the Enterprise Manager and now SQL server Management Studio, these operations are all the same! For example, create a view, right-click the view, and create a new view. The Wizard will be available in the future!
The following focuses on the use of T-SQL statements to execute these operations summary:
Here is an example of creating a view:
For example, to create a view in the company database, the results returned by the view must contain the information project name, customer name, employee name, start date, and estimated duration.
Use company create view Project Information view as select. project name, B. customer name, c. name, a, start date,. expected construction period From project as a inner join customer as B On. customer ID = B. customer No. innerjoin employee as c Where. customer ID = B. customer ID and. owner ID = c. no. go
Of course, we can also perform some operations on the data in the table through the View: