1.查看当前数据库的所有表 show tables;
2.创建数据表 create table 数据表的名字 (字段 类型 约束[,字段 类型 约束]) create table xxxx(id int , name varchar(30))
指定ID 的约束
create table xxxx(id int primary key not null auto_increment, name varchar(30))
create table student(
id int unsigned not mull auto_increment primary key, //unsigned 无符 号类型 整数 不为空 自动增长 初始值 主健
name varchar(30),
age tinyint unsigned default 0,
high decimal(5,2),
gender enum("男","女","保密") default "保密",
cls_id int unsigned
)
3.查看具体数据表 desc xxxx;
4.表中插数据 insert into 表名字 values(0,"老外",18,188.88,“男”,0)
5 select * from 数据表名字 查询表中的 所有数据
网友评论