Home > Database > Mysql Tutorial > What is the difference between mysql views and tables

What is the difference between mysql views and tables

青灯夜游
Release: 2022-04-12 15:55:47
Original
6374 people have browsed it

Difference: 1. Views are compiled SQL statements, but tables are not; 2. Views do not have actual physical records, but tables do; 3. Tables are content, while views are windows; 4. Tables It occupies physical space, but the view only exists as a logical concept and does not occupy physical space; 5. The table is an internal mode and the view is an external mode; 6. The table belongs to the global mode and the view belongs to the local mode.

What is the difference between mysql views and tables

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

What are MySQL views?

MySQL View is a virtual table. Like a real table, a view is composed of columns and rows, but the view does not actually exist in the database. The row and column data come from the tables used in the query that defines the view, and are dynamically generated when the view is used.

The database only stores the definition of the view, and does not store the data in the view. These data are stored in the real table referenced by the query that defines the view. When using a view to query data, the database will retrieve the corresponding data from the real table. Therefore, the data in the view depends on the data in the real table. Once the data in the real table changes, the data displayed in the view will also change.

The difference between mysql views and tables

1. Views are compiled SQL statements; tables are not.

2. Views do not have actual physical records; tables do.

3. The table is the content, and the view is the window.

4. The table occupies physical space, but the view does not occupy physical space. The view is just a logical concept; the table can be modified in time, But the view can only be modified by creating statements

5. The table is an internal schema and the view is an external schema

6. The table belongs to the table in the global schema and is a real table; the view belongs to the local The schema table is a virtual table.

7. The creation and deletion of a view only affects the view itself and does not affect the corresponding basic table.

The relationship between mysql views and tables

The view (view) is a table built on the basic table, and its structure (that is, the The defined columns) and content (that is, all data rows) come from the base table, and it exists based on the existence of the base table. A view can correspond to one basic table or multiple basic tables. Views are abstractions of basic tables and new relationships established in a logical sense.

[Related recommendations: mysql video tutorial]

The above is the detailed content of What is the difference between mysql views and tables. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template