MySQL筆記 資料庫與資料表(內附例子)

2022-09-19 20:24:09 字數 2003 閱讀 2992

修改資料庫

刪除資料庫

選擇(開啟)資料庫

建立資料表

修改資料表

刪除列刪除資料表

]( 列名1 資料型別 [列級約束]

[預設值]

, 列名2 資料型別 [列級約束]

[預設值],.

.....);

create

table 表名1

select

*from 表名2

add 列名 資料型別;

change 舊 新 型別;

alter

table

modify 列名 新型別;

修改表名

alter

table

rename 新錶名;

drop 列名;

] 表1

[,表2

,表3,..

....

,表n]

;

MySQL 資料庫 資料表

1 檢視原始資料庫information schema中的表,並顯示出views表的字段結構屬性資訊 第一步 檢視所有的資料庫 show databases 如圖一 第二步 檢視information schema 內容 如圖二 第三步 檢視views 結構 如圖三 2 建立乙個offcn資料庫,並...

mysql學習筆記 資料表的操作

建立表 create table if not exists tbl name 欄位名稱 字段型別 完整性約束條件 欄位名稱 字段型別 完整性約束條件 engine 儲存引擎 charset 編碼方式 檢視當前資料庫下已有資料表 show extended full tables db name l...

MySQL資料庫學習 資料表

1.開啟資料庫 use 資料庫名 2.檢視開啟的資料庫 select database 3.建立資料表 create table if not exists 表名 列名 資料型別 約束條件 4.檢視資料表結構 show columns from 表名 5.插入資料 insert into 表名 列名...