Differences in views and tables

Source: Internet
Author: User

Data in a database is stored in a table , whereas a view is simply a result set of one or more tables that are combined according to a condition, in general you can modify the data in the table with SQL statements such as Update,insert,delete. The view can only be a select operation . However, there are also updatable views, and operations such as Update,insert and delete for such views will eventually be used for data in their related tables. Therefore, a table is the basis for data storage in a database, and a view is simply an object that is built to meet a query requirement.

The table is physically present and you can understand the files in the computer!
The view is a virtual memory table that you can understand as a shortcut to Windows!

1. A view is a specific subset of database data. You can prevent all users from accessing database tables, and require users to manipulate data only through views, which can protect users and applications from certain database modifications.  2. The view is abstract, and when used, extracts the data from the table and forms a virtual table. But there are a lot of restrictions on his operation.
3. And the view is never going to disappear by itself unless you delete it.
Views can sometimes be helpful in improving efficiency. Temporary tables are almost not useful for performance and are resource users.
Views are typically stored with the database, and temporary tables are always in tempdb.
4. The view is suitable for multi-table connection browsing when used! Not suitable for adding, deleting, changing., stored procedures are suitable for using more frequent SQL statements, which can improve the efficiency of execution!


Differences and linkages between views and tables

Difference: 1, the view is a compiled SQL statement. And the table is not
2. The view has no actual physical record. and the table has.
3, the table is the content, the view is the window
4, the table only uses the physical space and the view does not occupy the physical space, the view is only the logical concept existence, the table can modify it in time, but the view can only have the creation statement to modify
5, the table is the internal mode, the view is the external mode
6, view is a way to view the data table, you can query some fields in the data table composed of data, just a collection of some SQL statements. From a security standpoint, the view does not know the table structure without giving the user access to the data table.
7, the table belongs to the global schema of the table, is a real table, the view belongs to the local mode of the table, is a virtual table.
8, the creation and deletion of views only affect the view itself, does not affect the corresponding base table.

Contact: A view is a table built on top of a base table whose structure (that is, defined columns) and content (that is, all data rows) come from the base table, which exists based on the existence of the base table. A view can correspond to a base table, or it can correspond to more than one base table. A view is an abstraction of a basic table and a new relationship that is established in a logical sense.

Differences in views and tables

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.