單元1 數(shù)據(jù)模型的規(guī)劃與設(shè)計..................................................................................................................... 1
1.1 數(shù)據(jù)庫基礎(chǔ)知識........................................................................................................................................... 2
1.2 數(shù)據(jù)庫的關(guān)系模型設(shè)計............................................................................................................................... 5
1.3 規(guī)范化數(shù)據(jù)庫設(shè)計....................................................................................................................................... 9
技能訓(xùn)練.............................................................................................................................................................. 12
單元2 數(shù)據(jù)庫和表的創(chuàng)建與管理.............................................................................................................. 13
2.1
MySQL的安裝與配置............................................................................................................................... 14
2.2 數(shù)據(jù)庫的創(chuàng)建與管理................................................................................................................................. 22
2.3 數(shù)據(jù)庫表的創(chuàng)建與管理............................................................................................................................. 25
2.4 建立數(shù)據(jù)完整性約束................................................................................................................................. 28
2.5 用圖形管理工具管理數(shù)據(jù)庫和表............................................................................................................. 33
技能訓(xùn)練.............................................................................................................................................................. 39
單元3 數(shù)據(jù)操作............................................................................................................................................... 41
3.1 插入表數(shù)據(jù)................................................................................................................................................. 42
3.2 修改表數(shù)據(jù)................................................................................................................................................. 44
3.3 刪除表數(shù)據(jù)................................................................................................................................................. 45
技能訓(xùn)練.............................................................................................................................................................. 46
單元4 數(shù)據(jù)查詢............................................................................................................................................... 47
4.1 簡單查詢..................................................................................................................................................... 48
4.2 條件查詢..................................................................................................................................................... 53
4.3 多表查詢..................................................................................................................................................... 60
4.4 分類匯總與排序......................................................................................................................................... 65
技能訓(xùn)練.............................................................................................................................................................. 74
單元5 數(shù)據(jù)視圖和索引................................................................................................................................. 75
5.1 視圖的創(chuàng)建................................................................................................................................................. 76
5.2 視圖的查詢................................................................................................................................................. 76
5.3 通過視圖操作數(shù)據(jù)..................................................................................................................................... 77
5.4 修改視圖定義............................................................................................................................................. 78
5.5 刪除視圖..................................................................................................................................................... 78
5.6 索引的創(chuàng)建................................................................................................................................................. 79
5.7 索引的刪除................................................................................................................................................. 79
技能訓(xùn)練.............................................................................................................................................................. 80
單元6 存儲過程和存儲函數(shù)....................................................................................................................... 81
6.1 創(chuàng)建存儲過程............................................................................................................................................. 82
6.2 顯示存儲過程............................................................................................................................................. 84
6.3 調(diào)用存儲過程............................................................................................................................................. 84
6.4 刪除存儲過程............................................................................................................................................. 85
6.5 流程控制語句............................................................................................................................................. 85
6.6 創(chuàng)建存儲函數(shù)............................................................................................................................................. 89
6.7 調(diào)用存儲函數(shù)............................................................................................................................................. 90
6.8 游標(biāo)的使用................................................................................................................................................. 90
技能訓(xùn)練.............................................................................................................................................................. 92
單元7 觸發(fā)器................................................................................................................................................... 93
7.1 創(chuàng)建觸發(fā)器................................................................................................................................................. 94
7.2 查看觸發(fā)器................................................................................................................................................. 96
7.3 在觸發(fā)器中調(diào)用存儲過程......................................................................................................................... 96
7.4 觸發(fā)器的應(yīng)用............................................................................................................................................. 97
7.5 刪除觸發(fā)器................................................................................................................................................. 97
技能訓(xùn)練.............................................................................................................................................................. 98
單元8 數(shù)據(jù)庫管理.......................................................................................................................................... 99
8.1 添加和刪除用戶....................................................................................................................................... 100
8.2 授予權(quán)限和回收權(quán)限............................................................................................................................... 101
8.3 數(shù)據(jù)的備份與恢復(fù)................................................................................................................................... 105
8.4
MySQL日志操作..................................................................................................................................... 107
8.5 數(shù)據(jù)庫的維護(hù)與優(yōu)化............................................................................................................................... 108
技能訓(xùn)練............................................................................................................................................................ 109
附錄 MySQL數(shù)據(jù)庫考試真題.................................................................................................................. 110