Difference Between View and Table

Difference Between View and Table

The data in the database is stored in the table , and the view is just a result set composed of one or more tables according to a certain condition. Generally speaking, you can use update, insert, delete and other SQL statements to modify the data in the table , and only select operations can be performed on the view . But there are also updatable views, and operations such as update, insert, and delete for such views will eventually act on the data in the tables related to them. Therefore, the table is the basis of data storage in the database, and the view is just an object established to meet a certain query requirement.

The table exists physically , you can understand it as a file in the computer!
View is a virtual memory table , you can understand it 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 protects users and applications from certain database modifications. 2. The view is abstract. When it is used, it extracts data from the table to form a virtual table. However, there are many restrictions on his operation.
3. And the view never disappears by itself unless you delete it.   Views are sometimes helpful for efficiency. Temporary tables rarely help performance and are resource consumers.   Views are generally stored with the database, and temporary tables are always in tempdb. 4. Views are suitable for multi-table connection browsing! Not suitable for addition, deletion, and modification. Stored procedures are suitable for frequently used SQL statements, which can improve execution efficiency!  The difference between views and tables and the difference between connections : 1. Views is a compiled SQL statement. While the table is not        2, the view has no actual physical records. And the table has.       3. The table is the content, and the view is the window       . 4. The table only uses physical space and the view does not occupy the physical space. The view is only the existence of the logical concept. The table can modify it in time, but the view can only be modified by the created statement.       5. The       table is the inner mode, the view is the outer mode From a security point of view, the view can not give the user access to the data table, and thus does not know the table structure.       7. The table belongs to the table in the global schema and is a real table; the view belongs to the table of the local schema and is a virtual table.       8. The creation and deletion of views only affect the view itself, not the corresponding basic table. 
 
 
 




 





 


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

Excerpted from: https://www.cnblogs.com/binyao/p/4899970.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325772890&siteId=291194637