当前位置:网站首页>视图简析
视图简析
2022-06-26 06:12:00 【Oh No 发量又少了】
1.对试图的理解
视图并不是真正的表,也不在数据库中真实的存在,是一种虚拟的表。对于视图我个人最直接的理解就是对某一个表或者多个表联合查询的结果,适用于查询,不适用于更新,相对于表而言,视图有以下优点:
- 简单:视图是sql执行查询语句所返回的结果,用户不用关心后面对应的表结构、关联条件和筛选条件。
- 安全:只让用户看到用户需要看到的结果集,对于一些隐私信息具体有一定的保护作用。
2.视图的创建
- 单表查询创建视图
create view [视图名]
select [列名]
from [表名]
where [条件]
- 多表联合查询创建视图
create view [视图名]
select [列名]
from [表1],[表2]
where [条件]
3. 视图的查看
视图的查看和普通表的查看没有任何区别,都是执行select语句进行查询
select * from 【视图名】
4. 修改视图
- 使用create or replace view语句
create or replace view 【视图名】
(列名) as select 【列名】 from 【表名】
- 使用alter语句进行修改
alter view 【视图名】 (【列名】)
as select 【列名】 from 【表名】
5. 撤销视图
drop view 【视图名】
边栏推荐
- EFK升级到ClickHouse的日志存储实战
- 数据可视化实战:实验报告
- Data visualization practice: Experimental Report
- Transformer中的Self-Attention以及Multi-Head Self-Attention(MSA)
- Interface oriented programming
- 低代码实时数仓构建系统的设计与实践
- MEF framework learning record
- Func < T, tresult > Commission - learning record
- Gof23 - factory mode
- Five solutions across domains
猜你喜欢

Evolution history of qunar Bi platform construction

卷妹带你学jdbc---2天冲刺Day2

Several promotion routines of data governance

Tencent's 2022 school recruitment of large factories started with salary, and the general contracting of cabbage is close to 40W!

ByteDance starts the employee's sudden wealth plan and buys back options with a large amount of money. Some people can earn up to 175%

TCP连接与断开,状态迁移图详解

Use the fast proxy to build your own proxy pool (mom doesn't have to worry about IP being blocked anymore)

消息队列-消息事务管理对比

Logstash——Logstash向Email发送告警邮件

Spark source code analysis (I): RDD collection data - partition data allocation
随机推荐
卷妹带你学jdbc---2天冲刺Day2
Thread status and stop
Logstash - logstash pushes data to redis
100 cases of go language
Transformer中的Self-Attention以及Multi-Head Self-Attention(MSA)
DPDK——TCP/UDP协议栈服务端实现(一)
Redis multithreading and ACL
MySQL-08
Getting to know concurrency problems
MEF framework learning record
技术Leader的思考技巧
numpy.frombuffer()
在web页面播放rtsp流视频(webrtc)
302. 包含全部黑色像素的最小矩形 BFS
消息队列-全方位对比
Library management system
Efk Upgrade to clickhouse log Storage Reality
Lamda expression
[spark] how to implement spark SQL field blood relationship
Architecture design method