Oracle 中的视图是什么?
What is a view in Oracle?
Oracle 和其他数据库系统中的视图 只是存储在内存中的 SQL 语句的表示,以便它可以很容易被重复使用.例如,如果我们经常发出以下查询
A View in Oracle and in other database systems is simply the representation of a SQL statement that is stored in memory so that it can easily be re-used. For example, if we frequently issue the following query
SELECT customerid, customername FROM customers WHERE countryid='US';
要创建视图,请使用 CREATE VIEW 命令,如本例所示
To create a view use the CREATE VIEW command as seen in this example
CREATE VIEW view_uscustomers
AS
SELECT customerid, customername FROM customers WHERE countryid='US';
此命令创建一个名为 view_uscustomers 的新视图.请注意,除了定义此视图的数据字典条目外,此命令根本不会导致任何内容实际存储在数据库中.这意味着每次查询此视图时,Oracle 都必须出去执行该视图并查询数据库数据.我们可以这样查询视图:
This command creates a new view called view_uscustomers. Note that this command does not result in anything being actually stored in the database at all except for a data dictionary entry that defines this view. This means that every time you query this view, Oracle has to go out and execute the view and query the database data. We can query the view like this:
SELECT * FROM view_uscustomers WHERE customerid BETWEEN 100 AND 200;
Oracle 会将查询转换成这样:
And Oracle will transform the query into this:
SELECT *
FROM (select customerid, customername from customers WHERE countryid='US')
WHERE customerid BETWEEN 100 AND 200
使用视图的好处
您可以在这篇文章中找到关于如何创建和管理视图的高级主题在 Oracle 中."
You can find advanced topics in this article about "How to Create and Manage Views in Oracle."
这篇关于Oracle 中的视图是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!