--show database;
--show create datebase test;
创建数据库--create datebase test
default character set utf-8;
删除数据库--drop database test;
修改数据库--alter database test default character set gdk;
使用数据库--use test;
创建表--create table student(
sid int,
sname varchar(20),
sage int
);
修改表名--alter table student rename to students
查看表--show tables;
查看表结构约束--desc student;
添加字段--alter table student add column sgender varchar(20);
修改字段类型--alter table student modify sgender varchar(2);
修改字段名 --alter table student change column sgender gender varchar(2);//要替换的名称放在后面名称
删除表--drop table student;
删除字段 --alter table student drop column sname;
--show create datebase test;
创建数据库--create datebase test
default character set utf-8;
删除数据库--drop database test;
修改数据库--alter database test default character set gdk;
使用数据库--use test;
创建表--create table student(
sid int,
sname varchar(20),
sage int
);
修改表名--alter table student rename to students
查看表--show tables;
查看表结构约束--desc student;
添加字段--alter table student add column sgender varchar(20);
修改字段类型--alter table student modify sgender varchar(2);
修改字段名 --alter table student change column sgender gender varchar(2);//要替换的名称放在后面名称
删除表--drop table student;
删除字段 --alter table student drop column sname;