1.创建数据库
create database 数据库名;
2.删除数据库
drop database 数据库名;
3.创建基本表
CREATE table
例如:
create table XSB
( XH char(6) not null primary key,----列级
XM char(8) not null,
XB bit default 1,
)
create table CJB
( XH char(6) not null
KCH char(3) not null
cj float
primary key(xh,kch)---表级
)
4.修改基本表
4.1查看当前数据库有哪些表
show tables;
4.2查看表的结构
desc 表名 description;
4.3在表中添加一列
alter table 表名 add 列名 数据类型;
4.4修改列的数据类型
alter table 表名 modify 列名 类型;
4.5修改列的名称
alter table 表名 change 旧列名 新列名 数据类型;