root //登录
show databases; //查询库名
create database test;//创建一个库
use test;//进入这个库
mysql> create table student(
-> sid int(14),
-> sname varchar(20),
-> ssex varchar(4)
-> ); //创建一个表格
show tables;//显示表格
//修改表格结构
/表格名字
alter table student rename to stu;//改为stu
alter table stu rename student;//改回 student
/修改列名
alter table student change sid snum int(14);//改原名sid 为snum
alter table student change snum sid varchar(20);//改名和长度
alter table student change sid sid int(14)// 改长度
/增加列
alter table student add abirthday data; // 增加生日这一列
/删除列
alter table student drop sbirthday;//删除生日这一列
//删除表格
drop table student ;//删除 table 表格
//删除数据库
drop database test;//删除 test 数据库
