MySQL数据操作 更新数据删除数据

MySQL数据操作 更新数据删除数据

MySQL知识qingyu2020-10-28 14:34:30965A+A-

  MySQL数据操作 更新数据删除数据

  更新数据:

  语法:

  update 表名 set 字段名=值[where 条件]

  MySQL数据操作 更新数据删除数据

mysql> update users set username='newlran' where id='1';

2.png

mysql> update users set username='newlran',age='30'   where id='1';

  删除数据:

  语法:

  delete from 表名 [where 条件] ] [order by 排序] [limit 限制]

 mysql> delete form users where id = 1;

MySQL数据操作 更新数据删除数据

mysql-> delete from users where username='newlran';

  --删除所有数据

mysql> delete form users

  多学一招:

  delete from表和truncate table 表的区别:

  delete from表:便利表记录,一条一条删除

  truncate table:将原表销毁,再创建同结构新表

 mysql> truncate table users;

MySQL数据操作 更新数据删除数据

点击这里复制本文地址 欢迎来到大黄鸡源码分享网
qrcode

大黄鸡源码编程网 © All Rights Reserved.  
网站备案号:闽ICP备18012015号-4
Powered by Z-BlogPHP
联系我们| 关于我们| 广告联系| 网站管理