sql中View和table的区别 [英] Difference between View and table in sql
问题描述
可能的重复:
视图和表的性能差异
SQL 中视图和表的主要区别是什么.使用视图代替表格有什么好处.
What is the main difference between view and table in SQL. Is there any advantage of using views instead of tables.
推荐答案
一个表包含数据,一个视图只是一个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.
不需要一直将复杂的查询发送到数据库,您可以将查询保存为视图,然后SELECT * FROM view
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
这篇关于sql中View和table的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!