首页 > 数据库技术 > 详细

SQL入门-DML数据操作语言

时间:2017-12-26 19:36:55      阅读:208      评论:0      收藏:0      [点我收藏+]

DML数据操作语言

1.针对数据行的操作

加大 -U 使用严格模式,限制update 和where语句

mysql -uroot -p -U

严格模式下删除数据需要使用索引,作为条件才能删除

mysql> delete from anyux.test;
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
-- 提示 当前为严格模式,你更新表不能没有where条件并且使用索引

 

 创建索引

alter table anyux.test add key id_idx(id);

 

删除数据

delete from anyux.test where id=8;
技术分享图片

--提示此处建立的普通索引,索引关系为一对多,仅测试,生产环境大数据量下会很慢。

 2.表迁移

--一个库迁移到另一个库
rename table anyux.test to anyuxweb.test;
技术分享图片

 

SQL入门-DML数据操作语言

原文:https://www.cnblogs.com/anyux/p/8119611.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!