当前位置:网站首页>Database view detailed exploration
Database view detailed exploration
2022-07-23 13:41:00 【kokotao】
One 、 Define views :
1 View creation :SQL Used in language CREATE VIEW Command to establish ;
Example :
Create view <name> [< Name >[,< Name >]···)]
as < Subquery > with check option];
The subquery can be any select sentence
In relational database management system create view The result of the statement is to save the definition of the view into the data , They don't execute select sentence .
Two 、 Row column subset view
Derived from a single basic table , And just remove some rows and columns of the basic table , But the main code is retained , Then this kind of view is called row and column view .
create view IS_Student
as
selcet Sno,Sname,Sage
from student
where Sdept='IS';
IS_Student The view can be regarded as a row column subset view ;
Views can not only be built on a single basic table , It can also be built on multiple basic tables ;
Views can not only be built on multiple basic tables , It can also be built on one or more defined views , Or based on basic tables and views .
3、 ... and 、 Delete view
sentence :
drop view < View name >[cascade];
Four 、 Query view
Example : In the view of information department students, find out that they are younger than 20 Year old student .
select Sno,Sage
from IS_Student
where Sage<20;
5、 ... and Update the view
Update view is generally used insert( Insert )、delete( Delete )、update( modify ) data ;
Example :
View computer students IS_Student The middle school number is 2011050321 The student's name is changed to “ Zhang Yu ”.
update IS_Student
set Sname=' Zhang Yu '
where Sno='2011050321';
The update statement after actual conversion is :
update Student
set Sname=' Zhang Yu '
where Sno='2011050321' and Sdept='IS';
6、 ... and The function of view ( advantage )
1 View can simplify the operation of users ;
2 Views enable users to view the same data from multiple perspectives ;
3 Views provide a certain degree of logical independence for refactoring the database ;
4 View can provide security for confidential data ;
5 Using views properly can express queries more clearly ;
边栏推荐
- Ros2 self study notes: gazebo physical simulation platform
- 0722~线程池扩展
- In depth interpretation of EVM's ecological Empire
- MetaApp开发面试题目
- Metaapp development interview questions
- Space shooting part 1: player spirit and control
- [jzof] 07 rebuild binary tree
- Target segmentation for 10000 frames of video, with less than 1.4GB of video memory | eccv2022
- 【记录】golang跨平台编译
- Successful joint commissioning of Vientiane Aoke and CoDeSys Technology
猜你喜欢

The current situation of the industry is disappointing. After working, I returned to UC Berkeley to study for a doctoral degree

高性能JVM的参数

反常积分的审敛

Point target simulation of SAR imaging (II) -- matlab simulation

网易白帽子黑客训练营笔记(2)

吴恩达机器学习系列篇p31~p42

深入解读 EVM 的生态帝国

kubernetes 的这几种存储卷,别再傻傻分不清了
![[jzof] 10 Fibonacci series](/img/65/ab5b22b0879644c210abb38b0ce640.png)
[jzof] 10 Fibonacci series

vs2019:constexpr 函数“qCountLeadingZeroBits”不能生成常量表达式
随机推荐
第七天笔记
In depth interpretation of EVM's ecological Empire
[jzof] 07 rebuild binary tree
ROS2自学笔记:Gazebo物理仿真平台
Beifu and C transmit real type through ads communication
第二章关系数据库课后习题
网易白帽子黑客训练营笔记(2)
The principle of Google interview questions is to analyze 12 table tennis balls, one of which is defective. Weigh it with a balance for 3 times to find it
China leads the United States in another emerging technology field and stands at the commanding height of scientific and technological innovation
Wu Enda machine learning series p31~p42
[noi simulation race] I don't know which CF paper title it is (probability expectation, martingale's stop time theorem)
Typora 修改表格宽度
ROS2自学笔记:URDF机器人建模
ROS中引用和输出消息类型
【MUDUO】Poller抽象类
About this pointer
Defi will never die?
Smart canteen data analysis system
"100 Android interview questions" I brushed angrily for Dachang
Introduction to radar part vii 4 SAR system design