Home> Database> Oracle> body text

What is the difference between oracle views and tables

青灯夜游
Release: 2021-12-24 13:45:08
Original
15916 people have browsed it

Difference: 1. The view is a compiled SQL statement, but the table is not; 2. The view does not have actual physical records, but the table does; 3. The table is the content, and the view is the window; 4. The table is Inner mode, the view is an outer mode; 5. The table belongs to the table in the global mode and is a real table, while the view belongs to the table in the local mode and is a virtual table.

What is the difference between oracle views and tables

The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.

1: What is a table:

The table is a data structure used to store data in the oracle database, which is equivalent to what we use in java Just like using a collection list or an array to store our data, a table is a two-dimensional structure with rows and columns. We group the same type of data into one column. For example, if everyone has a name, we group the name into one column. The age is grouped into one column, and the rows correspond to each person's data. For example, the first row is Xiaohong's name and age, and the second row is Xiaoqiang's name and age. By creating a table and then inserting data into the table, information is ultimately stored.

2: What is a view:

1. Why use a view?

For example, the company personnel information table has their salary status, and the finance department will pay everyone a salary based on the salary in the database, so the salary column is very important, so In order to ensure orderly operation, we generally cannot let the database administrator see this column. After all, the administrator is also an employee. It may be best for everyone that he cannot see this sensitive information. Then it comes to how to solve this problem. Some people will say to create a new employee table without the employee salary column, but this method is very unwise, because when we modify the original data, wouldn’t it be If you need to make another modification on the new table, and if you make modifications on the new table, you need to update the main table. Many problems will occur in the middle. At this time, using views is the most reasonable method.

View is a logically related data set extracted from an existing table. It is not much different from the table. They are both a kind of storage of data, but we can extract part of it based on the existing table. The data we want.

2. Will it be updated to the base table after we modify the view?

This is for sure. The meaning of a view is to extract part of the data in the base table and then provide it to others for operation. If the base table cannot be updated, it has nothing to do with creating a new table. The difference is that the view can be updated immediately if the data in the base table changes.

Three: Difference:

1. Views are compiled sql statements. The watch is not.

2. The view has no actual physical record. And the table has.

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

4. The table only uses physical space but the view does not occupy physical space. The view is only a logical concept. The table can be modified in time, but the view can only be modified by the creation statement.

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

6. View is a way to view the data table. It can query the data composed of certain fields in the data table. It is just a collection of SQL statements. From a security perspective, the view does not allow users to access the data table, so they do not know the table structure.

7. Tables belonging to the global schema are real tables; views belonging to the local schema are virtual tables.

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

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of What is the difference between oracle 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!