查询所有库,
show databases;
查询库的字符集
show create database 库名;
修改库的字符集
alter database 库名 default character set 修改后的字符集;
删除库的语法
drop database 库名;
drop database if exists 库名;
新建库
create database 库名;
create database if not exists 库名;
2.DDL语句创建表的语法
create table 表名(
字段名称1 字段类型1,
...
)
3.修改表的字段类型
alter table 表名 modify 当前的字段名称 新的字段类型;
修改表的字段名称
alter table 表名 change 旧字段名称 新的字段名称 以前的数据类型;
添加字段
alter table 表名 add 字段名称 字段类型;
删除字段
alter table 表名 drop 字段名称;
查询表的结构
desc 表名;
查询库中有哪些表
show tables;
复制一张表
create table 新表名 like 旧表名;
删除表
drop table 表名;
drop table if exists 表名;