In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
A view is a SELECT query saved in a database that executes most commands of SELECT statements on the view. There are two reasons for creating views: first, for security reasons, users do not have to see the entire database structure, but hide part of the data; second, it is in line with the daily business logic of users, making it easier to understand the data.
What is a view?
A view is another way to view data in one or more tables in a database. A view is a virtual table, usually created by a subset of the rows and columns of one or more tables. It is not a collection of data values stored in the database. Its rows and columns come from the table referenced by the query. At execution time, the view directly displays the data in the table.
Queries that define views can be based on one or more tables, or on other views, current databases, and other databases
The role of views
* filter rows in the table
* prevent unauthorized users from accessing sensitive data
* abstract multiple physical data tables into a logical data table
Benefits of using views
1. For end users
* the result is easier to understand, and the column name can be changed to a meaningful name
* it is easier to obtain data, and you can view it through the view without knowing the T-SQL statement of multi-table query.
two。 For developers
* it is easier to restrict retrieval. When creating a view, the columns that are confidential to the user are excluded.
* it is more convenient to maintain applications
Create a view
In SQL Server, there are two ways to create a view: using SSMS and using T-SQL statements
1. Create a view using SSMS
(1) expand the database, right-click the view, and select New View.
(2) Select the desired table, select the column you want to view, fill in the alias, or modify the following T-SQL statement to execute
(3) finally, choose Save, and you can use it just like opening a regular table.
two。 Create a view using the T-SQL statement
The syntax for creating a view is as follows:
Create view View name as T-SQL statement
For example: create a view for students in an online class, showing only name, gender, and class
Considerations for working with views
Multiple tables can be used in each view
Similar to a query, one view can nest another, but it is best not to exceed three layers
SELECT statements in a view definition cannot include the following
* ORDER BY statement, unless there is also a TOP clause in the select list of the SELECT statement
* INTO keyword
* reference temporary tables or table variables
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.