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;-- 查看导入数据结果

 

上一篇:PLSQL_Oracle Exception异常分类、异常抛出、异常处理、异常传播(概念)


下一篇:MySQL中删除表的类型和区别