当前位置:网站首页>mySql data view
mySql data view
2022-08-01 00:14:00 【face to face】
携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第4天,点击查看活动详情
一、 数据视图
视图是原始数据库数据的一种变换,是查看表中数据的另外一种方式.We can think of the view as a moving window,Data of interest can be seen from this window.
二、Data View Operations
创建视图
// 标准语法: CREATE VIEW 视图名称 [(列名列表)] AS 查询语句;
// 创建city_country视图,保存城市和国家的信息(使用指定列名)
CREATE VIEW city_country(city_id,city_name,country_name)
AS
SELECT c1.id, c1.name, c2.name FROM city c1, country c2 WHERE c1.cid = c2.id;
复制代码
修改视图数据
// 标准语法: UPDATE 视图名称 SET 列名=值 WHERE 条件;
// 注意:修改视图数据后,源表中的数据也会随之修改
UPDATE city_country SET city_name="深圳" WHERE city_name="北京";
复制代码
Modify view listings
// 标准语法: ALTER VIEW 视图名称 (列名列表) AS 查询语句;
ALTER VIEW city_country (city_id, city_name, NAME) AS
SELECT c1.id, c1.name, c2.name
FROM city c1, country c2
WHERE c1.cid = c2.id;
复制代码
删除视图
// 标准语法 DROP VIEW [IF EXISTS] 视图名称;
// 删除city_country视图
DROP VIEW IF EXISTS city_country;
复制代码
三、数据的备份与回复
liunx备份
- 备份文件
mysqldump -u root -p 数据库名称 > 文件保存路径
复制代码
- 还原
source 文件保存路径
复制代码
mysql备份
备份-> Export the backup database 还原-> 导入备份文件
四、
未完待续....
边栏推荐
- 【云驻共创】【HCSD大咖直播】亲授大厂面试秘诀
- 硬件设备计算存储及数据交互杂谈
- NgRx 里 first 和 take(1) 操作符的区别
- [MATLAB project combat] LDPC-BP channel coding
- Matlab/ArcGIS processing GPM global monthly precipitation data
- Rainbow share | how to use moving targets defense technology to guard against the unknown
- 一行代码解决CoreData托管对象属性变更在SwiftUI中无动画效果的问题
- SQL injection Less46 (injection after order by + rand() Boolean blind injection)
- /etc/sysconfig/network-scripts 配置网卡
- EntityFramework保存到SQLServer 小数精度丢失
猜你喜欢
NIO programming
[Reading Notes -> Data Analysis] 02 Data Analysis Preparation
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
(26) About menu of the top menu of Blender source code analysis
SVN server construction + SVN client + TeamCity integrated environment construction + VS2019 development
精心总结十三条建议,帮你创建更合适的MySQL索引
UOS统信系统 - WindTerm使用
Redis五种数据类型简介
Matlab/ArcGIS processing GPM global monthly precipitation data
【MATLAB项目实战】LDPC-BP信道编码
随机推荐
[Reading Notes -> Data Analysis] 02 Data Analysis Preparation
Shell common script: Nexus batch upload local warehouse script
Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix
SQL injection Less42 (POST type stack injection)
Automated machine learning pycaret: PyCaret Basic Auto Classification LightGBM
What is customer profile management?
Interview Blitz 69: Is TCP Reliable?Why?
内核对设备树的处理
编译型语言和解释型语言的区别
vim的基本使用-底行模式
NIO programming
面试突击69:TCP 可靠吗?为什么?
Xinao Learning Plan The Road to Informatics Competition (2022.07.31)
[QNX Hypervisor 2.2 User Manual]9.16 system
Google Earth Engine——Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid type的错误解决
Usage of mysql having
NgRx 里 first 和 take(1) 操作符的区别
硬件设备计算存储及数据交互杂谈
/etc/resolv.conf的作用
Introduction to the five data types of Redis