当前位置:网站首页>MySQL表sql语句增删查改_修改_删除
MySQL表sql语句增删查改_修改_删除
2022-08-11 09:49:00 【华为云】
修改(Update)
语法:
UPDATE table_name SET column = expr [, column = expr ...][WHERE ...] [ORDER BY ...] [LIMIT ...]SQL语句update 表名 set 列名= 修改后的值 where 条件;
案例:
-- 将孙悟空同学的数学成绩变更为 80 分UPDATE exam_result SET math = 80 WHERE name = '孙悟空';-- 将曹孟德同学的数学成绩变更为 60 分,语文成绩变更为 70 分UPDATE exam_result SET math = 60, chinese = 70 WHERE name = '曹孟德';-- 将总成绩倒数前三的 3 位同学的英语成绩加上 30 分UPDATE exam_result SET math = math + 30 ORDER BY chinese + math + english LIMIT3;-- 将所有同学的语文成绩更新为原来的 2分之一UPDATE exam_result SET chinese = chinese /2;



删除(Delete)
SQL语句delete from 表名 where 条件;
-- 删除孙悟空同学的考试成绩DELETE FROM exam_result WHERE name = '孙悟空';-- 删除整张表数据-- 准备测试表DROP TABLE IF EXISTS for_delete;CREATE TABLE for_delete (id INT,name VARCHAR(20));-- 插入测试数据INSERT INTO for_delete (name) VALUES ('A'), ('B'), ('C');-- 删除整表数据DELETE FROM for_delete;

边栏推荐
猜你喜欢

PowerMock for Systematic Explanation of Unit Testing

How to determine the neural network parameters, the number of neural network parameters calculation

深度神经网络与人脑神经网络哪些区域有一定联系?

Network Models (DeepLab, DeepLabv3)

The mathematical knowledge required for neural networks, the mathematical foundation of neural networks

Adobe LiveCycle Designer 报表设计器

单元测试系统化讲解之PowerMock

【剑指offer】左旋字符串,替换空格,还有类题!!!

HDRP shader 获取像素深度值和法线信息

The no-code platform helps Zhongshan Hospital build an "intelligent management system" to realize smart medical care
随机推荐
canvas图像阴影处理
WooCommerce Ecommerce WordPress Plugin - Make American Money
How to determine the neural network parameters, the number of neural network parameters calculation
淘宝/天猫获得淘宝app商品详情原数据 API
MATLAB实战Sobel边缘检测(Edge Detection)
基于卷积的神经网络系统,卷积神经网络毕业论文
5分钟快速为OpenHarmony提交PR(Web)
How to use QTableWidget
HStreamDB v0.9 released: Partition model extension, support for integration with external systems
HDRP shader 获取阴影(Custom Pass)
Three handshakes and four waves
Typora and basic Markdown syntax
Unity shader test execution time
OAK-FFC系列产品上手指南
网络流行简笔画图片大全,关于网络的简笔画图片
使用stream实现两个list集合的合并(对象属性的合并)
What is the difference between the qspi interface and the ordinary four-wire SPI interface?
【Prometheus】 Grafana数据与可视化
pycharm 取消msyql表达式高亮
分割学习(loss and Evaluation)