數(shù)據(jù)庫(kù)名字不可以修改
數(shù)據(jù)庫(kù)的修改僅限庫(kù)選項(xiàng)蝶棋,即字符集和校對(duì)集(校對(duì)集依賴(lài)字符集)
alter database 數(shù)據(jù)庫(kù)名字 [庫(kù)選項(xiàng)];
charset/character set [=] 字符集
collate 校對(duì)集
刪除數(shù)據(jù)庫(kù)
drop database 數(shù)據(jù)庫(kù)名字;
新增數(shù)據(jù)表
create table [if not exists] 表名(
字段名字 數(shù)據(jù)類(lèi)型,
……
字段名字 數(shù)據(jù)類(lèi)型
) [表選項(xiàng)];
查看數(shù)據(jù)表
查看所有表:show tables;
查看部分表(模糊查詢(xún)):show tables like 'pattern';
pattern是匹配模式
%表示匹配多個(gè)字符
_表示匹配單個(gè)字符
查看表的創(chuàng)建語(yǔ)句:show create table 表名;
查看表結(jié)構(gòu)(表中的字段信息):desc/describe/show columns from 表名;