mysql 练习基础 9:删除数据并手动导入数据
2021/10/10 16:50:35
本文主要是介绍mysql 练习基础 9:删除数据并手动导入数据,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
truncate table orders;-- 删除表orders数据 #删除数据 # delete from 表名[ where 删除条件]; # truncate 表名;(与delete from 表名一样,都是删除表中全部数据,保留表结构) #delete和truncate的区别: #dlete可以添加where子句删除表中部分数据,truncate只能删除表中全部数据 #dlete删除表中数据保留表结构,truncate直接把表删除(drop table)然后再创建一张新表(create table),执行速度比delete快。 insert into orders values ("o01","u01","c01","2021-10-1"), ("o02","u01","c01","2021-10-2"), ("o03","u01","c01","2021-10-2"), ("o04","u02","c02","2021-10-03"), ("o05","u03","c02","2021-10-30"), ("o06","u03","c02","2021-10-01"), ("o07","u04","c03","2021-10-03"), ("o08","u04","c03","2021-10-04"), ("o09","u04","c03","2021-10-04"), ("o10","u04","c03","2021-10-06"); select * from orders;-- 查看导入数据结果
这篇关于mysql 练习基础 9:删除数据并手动导入数据的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-20MySQL集群部署教程:入门级详解
- 2024-11-20MySQL集群教程:入门与实践指南
- 2024-11-20部署MySQL集群教程:新手入门指南
- 2024-11-20MySQL读写分离教程:轻松入门
- 2024-11-20部署MySQL集群入门:一步一步搭建你的数据库集群
- 2024-11-19部署MySQL集群学习:入门教程
- 2024-11-19如何部署MySQL集群:新手入门教程
- 2024-11-19Mysql安装教程:新手必看的详细安装指南
- 2024-11-18Mysql安装入门:新手必读指南
- 2024-11-18MySQL事务MVCC原理入门详解