1. 打开数据库
use 数据库名;
2. 创建表
create table 表名
(
字段名 数据类型 [列级约束],
字段名 数据类型 [列级约束] ,
.....
表级约束
);
3. MySQL支持的主要数据类型
int 整型
char(n) 定长字符型
varchar(n) 变长字符型
float(m,d) 单精度型,m表示总位数,d表示小数位数
decimal(m,d) 双精度型
date 日期型
4. 查看表的结构
describe 表名; 或简写 desc 表名;
5. 查看这个数据库中有哪些表
show tables;
6. 查看创建的表的详细信息
show create table 表名;
7. 删除表
drop table 表名;
MySQL-②创建表
猜你喜欢
转载自blog.csdn.net/weixin_43823808/article/details/104457519
今日推荐
周排行