码迷,mamicode.com
首页 > 数据库 > 详细

mysql常用增删改查命令(纯纪录.orm用得基本功都没了。)

时间:2016-08-08 17:07:37      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:

更新表数据:

update table_name set xxx=xxx where condition;

增加字段:

alter table table_name add field type other;

e.g:
alter table MyClass add passtest int(4) default 0;

删除字段:

ALTER TABLE table_name DROP field_name;

增加删除索引:

# 增加
alter table 表名 add index 索引名 (字段名1[,字段名2 …]);
# 删除
alter table 表名 drop index 索引名;

添加数据:

insert into table_name (<field1>[,..<field_n > ]) values (< value_1 >[, (<value_n >]);

删除数据:

delete from table_name where condition;

修改表名:

 rename table table_name to other_table_name;

删除数据表:

drop table table_name;

 

 

 

Reference:

http://c.biancheng.net/cpp/html/1456.html

mysql常用增删改查命令(纯纪录.orm用得基本功都没了。)

标签:

原文地址:http://www.cnblogs.com/piperck/p/5749782.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!