mysql常用命令

1. show databases;  查看数据库

2. use  数据库名称; 切换使用指定的数据库

3. show tables;查看当前数据库中存在的表

4. 创建一张表,简单举例如下:

create table person( id int not null, name varchar(20), age int) ;

5. 添加对象到表中:

insert into person values ('1','smith','17');

6. drop  表名; 删除表

7. 更改表结构:

增加属性:

alter table 表名 add 字段名 字段类型;

修改某个特性的属性:
alter table 表名 modify 列名 新的数据类型

8.查看当前表

 SELECT DATABASE(); 

posted @ 2017-04-06 22:49  阿拉米苏  阅读(150)  评论(0编辑  收藏  举报