mysql常用命令用法

时间:2014-04-28 02:34:53   收藏:0   阅读:560

1.创建数据库:create database database_name;

2.选择数据库:use database_name;

3.创建表:create table tablename(column1 data_type1, column2 data_type2,...,columnn datatypen);

4.设置表主键:alter table tablename add primary key(column_name);

5:修改表的字段名:alter table tablename change old_column_name new_column_name data_type;

6:设置not null:alter table tablename modify column_name data_type not null;

7:插入一条数据:insert into tablename(column_name1, ... , column_namen) values(‘value1‘, ... , ‘valuen‘);

8:插入多条数据:insert into tablename(column_name1, ... , column_namen) values(‘value1‘, ... , ‘valuen‘),(...), ..., (...);

 

mysql常用命令用法,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!