What are the advantages and disadvantages of using views in SQL

Source: Internet
Author: User

Advantages and disadvantages of views

In the program design, you must understand the pros and cons of the view, so as to avoid weaknesses, the view has some of the following advantages:

Simplicity. Views not only simplify the user's understanding of the data, they can also simplify their operations. Those queries that are used frequently can be defined as views, so that users do not have to specify all the conditions for subsequent operations each time.

Security Users can only query and modify the data they see through the view. Other data in the database is neither visible nor can be taken. The database Authorization command enables each user to limit the retrieval of a database to a specific database object, but not to a specific row or column on a database. With views, users can be limited to different subsets of the data.

Logical data independence. Views enable applications and database tables to be somewhat independent. If there is no view, the application must be built on the table. With a view, the program can be built on top of the view so that the program is separated from the database table by the view.

The view also has some drawbacks, mainly as follows.

Performance: SQL Server must turn the query of the view into a query for the base table, and if the view is defined by a complex multi-table query, then even a simple query of the view, SQL Server will turn it into a complex combination that takes some time.

Modify limit: When a user attempts to modify some rows of a view, SQL Server must convert it to some row of the base table. This is convenient for simple views, but it can be non-modifiable for more complex views.

Therefore, when defining a database object, you cannot define the view without selecting it, you should weigh the advantages and disadvantages of the view and define the view reasonably.

What are the advantages and disadvantages of using views in SQL

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.