当前位置:网站首页>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 还原-> 导入备份文件
四、
未完待续....
边栏推荐
- Network security - crack WiFi through handshake packets (detailed tutorial)
- 清华大学陈建宇教授团队 | 基于接触丰富机器人操作的接触安全强化学习框架
- 一文概述:VPN的基本模型及业务类型
- Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
- Mysql environment installation under Linux (centos)
- 力扣二叉树
- 基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真
- 命名实体识别-模型:BERT-MRC
- 继承和友元,静态成员的关系
- [微服务]分布式事务解决方案-Seata
猜你喜欢
什么是动态规划,什么是背包问题
NIO编程
力扣二叉树
/etc/sysconfig/network-scripts configure the network card
What is customer profile management?
Likou Binary Tree
【Acwing】The 62nd Weekly Game Solution
[AMEX] LGBM Optuna美国运通信用卡欺诈赛 kaggle
Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
[Microservice] Distributed Transaction Solution - Seata
随机推荐
How to Design High Availability and High Performance Middleware - Homework
LeetCode--The problem of robbery
SQL injection Less47 (error injection) and Less49 (time blind injection)
继承和友元,静态成员的关系
Kyoto University: Masaki Waga | Dynamic Masking for Reinforcement Learning in Black Box Environments
Flutter教程之四年开发经验的高手给的建议
一行代码解决CoreData托管对象属性变更在SwiftUI中无动画效果的问题
硬件设备计算存储及数据交互杂谈
SQL injection Less46 (injection after order by + rand() Boolean blind injection)
SQL injection Less54 (limited number of SQL injection + union injection)
精心总结十三条建议,帮你创建更合适的MySQL索引
lua入门案例实战1234定义函数与标准函数库功能
博弈论(Depu)与孙子兵法(42/100)
Daily--Kali opens SSH (detailed tutorial)
qlib量化源码分析:qlib/qlib/contrib/model/gbdt.py
类和对象:上
Basic use of vim - bottom line mode
Flink 1.13(八)CDC
Compose principle - the view and the principle of two-way data binding
高等代数_证明_任何矩阵都相似于一个上三角矩阵