MS SQL Basics Tutorial: Introduction to Views

Source: Internet
Author: User
Tags split

A view is a table that is exported from one or more tables or views, and whose structure and data are based on a query to a table. As with tables, views include several defined data columns and rows of data, but in essence these data columns and rows of data originate from the tables they refer to. So the view is not a real base table but a virtual table, and the data for the view is not actually stored in the database in the view structure, but is stored in the table referenced by the view.

The view is stored in the database once defined, and its corresponding data is not stored in the database in the same way as a table, and the data seen through the view is only data stored in the base table. The action of the view is the same as the action on the table, which can be queried, modified (with certain restrictions), deleted.

When you modify the data that you see through the view, the data for the underlying table changes, and if the data for the underlying table changes, the change is automatically reflected in the view.

Views have many advantages, mainly reflected in:

• Viewpoint Focus

• Streamline operations

• Custom Data

• Merging split data

• Security

13.9.1 Focus

A view set is one that allows users to care only about certain specific data that they are interested in and the specific tasks they are responsible for. This improves the security of the data by allowing only the user to see the data defined in the view instead of the view referencing the data in the table.

13.9.2 Simplified operation

The view greatly simplifies the user's manipulation of the data. Because when you define a view, the view itself is the result set of a complex query, so that when you execute the same query every time, you do not have to write back these complex query statements, as long as you have a simple query view statement. The visible view hides the complex connection operations between tables from the user.

13.9.3 Custom Data

Views enable different users to see different or identical sets of data in different ways. Therefore, this is extremely important when there are many different levels of users sharing the same database.

13.9.4 Merge split data

In some cases, because the amount of data in the table is too large, the table is often divided horizontally or vertically in the design of the table, but the change of the structure of the table has a bad effect on the application. If you use a view, you can retain the original structure relationship so that the external mode remains unchanged, and the existing application can still overload the data through the view.

13.9.5 Security

Views can be used as a security mechanism. View users can only view and modify the data they can see. Other databases or tables are neither visible nor accessible. If a user wants to access the result set of a view, it must be granted access. The access rights of the table referenced by the view do not affect the settings of the View permissions.

See the full set of "MS SQL Basics Tutorials"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.