sql中视图和表之间的区别是什么 [英] What is the difference between view and tables in sql

查看:129
本文介绍了sql中视图和表之间的区别是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sql中的视图和表有什么区别

What is the difference between view and tables in sql

推荐答案

问题完全不正确,就像大多数关于差异的问题一样。为什么询问您是否显然可以访问Internet?您可以阅读:

http://en.wikipedia.org/wiki/View_ %28database%29 [ ^ ] 。



-SA
The question is totally incorrect, like most question about "differences". Why asking if you apparently have Internet access? You could just read:
http://en.wikipedia.org/wiki/View_%28database%29[^].

—SA


一个表包含数据,一个视图只是一个SELECT语句已保存在数据库中(或多或少,取决于您的数据库)。



视图的优点是它可以连接来自多个表的数据,从而创建一个它的新观点。假设您有一个带工资的数据库,您需要对其进行一些复杂的统计查询。



您可以随时将复杂查询发送到数据库将查询保存为视图然后选择SELECT * FROM视图..



如果其他解释对您来说太技术性:



- 表是保存行的实际数据库实体。



- 视图是基于实际表构造的虚构表。



您知道的表存储实际数据。视图将需要并使用实际表中的实际列。创建视图时,会在SQL语句中过滤行。当连接多个表时,视图允许更容易地查看表和/或访问表中的数据。它们通常用于查看特定数据集以便于访问或决策。例如,我有一个基于我的Customer和Order表构建的视图。此视图仅包含填写发票所需的列。拥有此视图将节省输入SQL语句以连接两个表(以及其余逻辑)并输出特定的列和行,而我可以使用select all语句来获取我需要的所有内容(当然必须在创建时查看;其他select语句可以进一步过滤视图)。更新和删除视图存在限制和限制。我会让你继续阅读。



来源:堆栈溢出 [ ^ ]& 雅虎 [ ^ ]
A table contains data, a view is just a SELECT statement which has been saved in the database (more or less, depending on your database).

The advantage of a view is that it can join data from several tables thus creating a new view of it. Say you have a database with salaries and you need to do some complex statistical queries on it.

Instead of sending the complex query to the database all the time, you can save the query as a view and then SELECT * FROM view..

In case the other explanations are too technical for you:

- Tables are the actual database entities that hold your rows.

- Views are "imaginary" tables that are constructed based on the actual tables.

Tables as you know store the actual data. Views will require and use actual columns from the actual tables. The rows are filtered in your SQL statement when creating the view. Views allows for easier viewing of tables and/or access to data in the tables when multiple tables are joined are joined. They are typically used to viewing specific data sets for easy access or decision making. For example, I have a view that is constructed based on my Customer and Order table. This view only has the columns that I need to fill out invoices. Having this view will save on typing SQL statements to join the two tables (and the rest of the logic) and output specific columns and rows while I can just use a select all statement to get all I need (all of course must be defined in view when creating it; other select statements can further filter a view). There are limitations and restrictions to updating and deleting from views. That I will leave you to read up on.

Source : Stack overflow[^] & yahoo[^]


1st: -



表:关系数据库由包含相关数据的表组成。

查看:

1.通过连接从一个或多个表创建视图,选择列。



2.视图充当用户和桌子之间的层。



3出于安全原因,创建视图以隐藏用户的某些列,并隐藏列中存在的信息。



4.视图减少了编写查询的工作量每次访问特定列。



5.可以在视图上创建报告。



6.查看不包含任何数据。



第二名: -

表包含行和列,列代表nting

包含数据或记录的字段和行。



View是一个包含运行时数据的虚拟表。



3rd: -

view是一个基于SQL

语句结果集的虚拟表。



视图包含行和列,就像真正的表一样。

视图中的字段是数据库中一个或多个真实的

表的字段。



你可以将SQL函数,WHERE和JOIN语句添加到

视图中,并将数据显示为数据来自

一个表。



4: -

View是一个虚拟表。就像表格一样,它包含字段,但是

它不包含任何数据。在运行时它包含

数据,然后它被释放。但是表存储数据占用一些空间。
1st:-

Table : Relational Database is composed of tables that contain related data.
View :
1. Views are created from one or more than one table by joins, with selected columns.

2. Views acts as a layer between user and table.

3. Views are created to hide some columns from the user for security reasons, and to hide information exist in the column.

4. Views reduces the effort for writing queries to access specific columns every time.

5. Reports can be created on views.

6. View doesn't contain any data.

2nd:-
Table comprises of rows and columns, columns representing
fields and rows containing the data or records.

View is a imaginay table which contains data at run time.

3rd:-
view is a virtual table based on the result-set of an SQL
statement.

A view contains rows and columns, just like a real table.
The fields in a view are fields from one or more real
tables in the database.

You can add SQL functions, WHERE, and JOIN statements to a
view and present the data as if the data were coming from
one single table.

4:-
View is a virtual table. Like table it contains fields but
it does not contain any data.In run time it contains the
data and after that it gets free.But table stores the datas
in database occupy some space.


这篇关于sql中视图和表之间的区别是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆