您的位置:首页 > 数据库 > MySQL

MySQL对数据表的基本操作语句

2017-09-14 21:40 615 查看
数据表的创建

create table user(
id int not null auto_increment,
username varchar(20) not null,
gender char(1) not null default 'M',
primary key(id)
);


查看数据库中所有的表

show tables;


查看表的结构

describe table_name;   or  desc table_name;


向表中添加内容

insert into user(id,username,gender) values(1,'xiaoD','M');


修改表的名字

alert table table_name rename table_new_name;


删除表

drop table table_name;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql 数据库 数据表