? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? 創(chuàng)建數(shù)據(jù)表
1數(shù)據(jù)表(表)是數(shù)據(jù)庫中最重要的組成成分之一少孝,也是其他對象的基礎饿序。
2.操作
? ? 打開數(shù)據(jù)庫: ? USE 數(shù)據(jù)庫名稱 ; ? ? ? ? ? ? ??
?顯示當前用戶打開的數(shù)據(jù)庫:? SELECT DATABASE(); ??
打開數(shù)據(jù)庫
3.創(chuàng)建數(shù)據(jù)表
CREATE TABLE [IF NOT EXISTS] table_name(
column_name data_type,
...
)
如:
創(chuàng)建數(shù)據(jù)表
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 查看數(shù)據(jù)表
1.查看數(shù)據(jù)表列表
SHOW TABLES [FROM db_name] [LIKE 'patten' | WHERE expr]
不僅可以查看當前數(shù)據(jù)庫下的數(shù)表,還可以查看其它數(shù)據(jù)庫下的數(shù)據(jù)表管嬉。
查看表
注意:那么當前數(shù)據(jù)庫還是test嗎皂林?當然是了
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? 查看數(shù)據(jù)表結(jié)構
1.查看數(shù)據(jù)表的結(jié)構
SHOW COLUMNS FROM tb1_name;
查看數(shù)據(jù)表結(jié)構