DDL数据库操作
DDL数据库操作:
1.查询:
查询所有数据库:show databases;
查询当前数据库:show database();
2.创建:create database [if not exists] 数据库名 [default charset 字符集(utf8mb4)] [collate 排序规则];
3.删除:drop database [if exists] 数据库名;
4.使用:use 数据库名
DDL表操作-查询:
1.查询当前数据库所有表:show tables;
2.查询表结构:desc 表名
3.查询指定表的建表语句:show create table 表名;
DDL表操作-创建:
create table(
字段1 字段1类型[comment 字段1注释],
字段2 字段2类型[comment 字段2注释],
字段3 字段3类型[comment 字段3注释],
......
字段n 字段n类型[comment 字段n注释]
)[comment 表注释];
tinyint:下面写错了!

tinyint:上面写错了!

char(10):定长字符串,字符串不足时,后面用空格填充,性能好
varchar(10):变长字符串,根据字符串的长度来计算空间,性能较差

浙公网安备 33010602011771号