当前位置:网站首页>视图简析
视图简析
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 【视图名】
边栏推荐
- Getting started with Python
- SQL Server view
- Keepalived to achieve high service availability
- Easy to understand from the IDE, and then talk about the applet IDE
- Prometheus和Zabbix的对比
- 跨域的五种解决方案
- 消息队列-全方位对比
- Getting to know concurrency problems
- Use the fast proxy to build your own proxy pool (mom doesn't have to worry about IP being blocked anymore)
- Mongodb -- use mongodb to intercept the string content in the field and perform grouping statistics
猜你喜欢
![Selective search for object recognition paper notes [image object segmentation]](/img/cf/d3b08d41083f37c164b26a96b989c9.png)
Selective search for object recognition paper notes [image object segmentation]
Explore small program audio and video calls and interactive live broadcast from New Oriental live broadcast

Logstash——Logstash将数据推送至Redis

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

Message queue - function, performance, operation and maintenance comparison

Redis underlying data structure

Spark source code analysis (I): RDD collection data - partition data allocation

Deeply uncover Ali (ant financial) technical interview process with preliminary preparation and learning direction

Tencent's 2022 school recruitment of large factories started with salary, and the general contracting of cabbage is close to 40W!
Web components series (10) -- realize the basic layout of mycard
随机推荐
如何设计好的技术方案
DPDK——TCP/UDP协议栈服务端实现(二)
打印数字的位信息
Matching environment of ES6
302. 包含全部黑色像素的最小矩形 BFS
Typora activation method
Basic construction of SSM framework
Tencent WXG internship experience (has offered), I hope it will help you!
Easy to understand from the IDE, and then talk about the applet IDE
Interface oriented programming
Summary of JVM interview focus (II) -- garbage collector (GC) and memory allocation strategy
DPDK——TCP/UDP协议栈服务端实现(一)
Redis underlying data structure
Connexion et déconnexion TCP, détails du diagramme de migration de l'état
Message queuing - omnidirectional comparison
Library management system
numpy. tile()
Install pyinstaller
Five solutions across domains
[intra group questions semester summary] some reference questions for beginners