mysql常用命令用法

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

mysql常用命令用法

上一篇:一道SQL的面试题之联想


下一篇:Oracle core03_ACID