sql中View和table的区别 [英] Difference between View and table in sql

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

问题描述

可能的重复:
视图和表的性能差异

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屋!

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