簡介 讀者對象 本書可作為普通高等學校計算機及信息專業的本專科生的教材,也適合從事資料庫應用程式開發人員參考之用。
本書特色 本書以本書內容豐富、結構合理、實用性強。力求理論敘述嚴謹,套用能力培養目標明確,原理 + SQL Server 2005 + 目前流行的資料庫訪問技術 + 模擬軟體企業實際開發流程的案例開發 + 實驗指導 + 課程設計指導,構成完整的實際開發能力的培養體系。
本書內容豐富、結構合理、實用性強。力求理論敘述嚴謹,套用能力培養目標明確,主要培養學生資料庫套用系統實際開發能力,介紹最新的資料庫套用與開發技術,以便與實際工作崗位無縫接軌。
本書主要特點 (1) 以關係資料庫系統為核心。在系統論述資料庫基本知識的基礎上,著重討論了關係資料庫的原理與實現,其中對關係數據模型、關係資料庫體系結構、關係規範化理論等都有較詳細、系統的說明。
(2) 教材對傳統資料庫的內容進行了精簡,如對層次資料庫、網狀資料庫僅對其模型做了簡要介紹,刪除了一些與作業系統聯繫較密切的存儲理論等。
(3) 為了反映當前資料庫領域的新技術、新水平和新趨勢。本教材介紹了分散式資料庫系統、面向對象資料庫、數據倉庫和數據挖掘等內容,力求反映當前資料庫技術的發展。
(4) 注重理論聯繫實際,加強資料庫套用開發技術的介紹。教材在資料庫語言(SQL)等資料庫套用技術方面進行了較為全面的論述,並結合一些實例較詳細地講解了資料庫設計方法,為讀者進行資料庫應用程式的開發提供了較紮實的基礎。結合SQL Server 2005的具體的資料庫管理系統,講解了資料庫一些管理技術的套用,使讀者在學習理論的同時有了具體的套用,也為讀者維護管理大中型資料庫系統打下基礎。本教材還介紹了C、C#和Java語言開發資料庫應用程式的基本技術,為讀者在選擇開發語言上提供了更廣闊的空間。
(5) 在內容選取、章節安排、難易程度、例子選取等方面充分考慮到理論教學和實踐教學的需要,力求使教材概念準確、清晰,重點明確,內容廣泛,便於取捨,每章均配有習題便於教學。
全書內容豐富,結構合理,實用性強。其中第7、8、9章的內容可以根據實際情況進行取捨,針對讀者現有的語言基礎選擇相應的章節學習。
本書配有電子課件、完整的開發案例原始碼、習題參考答案等教學資源,需要者可從華信教育資源網免費註冊下載。
……
前言 資料庫技術產生於20世紀60年代末。經過40多年的迅猛發展,已經形成了完整的理論與技術體系,並已成為計算機科學與技術中的一個重要分支。隨著信息技術的迅猛發展,資料庫技術已經成為國家信息基礎設施和信息化社會中的最重要的支撐技術之一。
伴隨著資料庫技術在國民經濟、科技和文化等各個領域的廣泛套用,資料庫及其設計技術已經受到了各行各業人員的普遍關注。資料庫課程已成為高等院校計算機科學與技術、信息工程、管理工程、信息管理與信息系統等專業的核心專業課程,並有越來越多的專業及相關技術人員提出了對資料庫知識的需求。
……
目錄 第1章 資料庫系統概述······························ (1)
1.1 資料庫系統的基本概念··························· (1)
1.1.1 數據管理與數據處理·························· (1)
1.1.2 資料庫······························· (2)
1.1.3 資料庫管理系統··························· (2)
1.1.4 資料庫系統····························· (2)
1.2 數據描述與數據模型···························· (4)
1.2.1 數據的3種範疇··························· (4)
1.2.2 信息世界中所涉及的基本概念······················ (4)
1.2.3 機器世界中所涉及的基本概念······················ (5)
1.2.4 實體間的聯繫···························· (5)
1.3 概念數據模型與E-R表示方法························ (6)
1.3.1 數據模型······························ (6)
1.3.2 概念數據模型···························· (7)
1.3.3 概念數據模型的E-R表示方法······················ (8)
1.3.4 概念數據模型實例·························· (8)
1.4 傳統數據模型概述···························· (10)
1.4.1 層次模型······························ (10)
1.4.2 網狀模型······························ (11)
1.4.3 關係模型······························ (13)
1.5 資料庫系統結構····························· (13)
1.5.1 資料庫系統模式的概念························ (13)
1.5.2 資料庫系統的三級模式結構······················ (14)
1.5.3 數據獨立性····························· (14)
1.6 資料庫管理系統的組成·························· (15)
1.7 資料庫系統的組成···························· (16)
1.8 小結·································· (16)
習題1···································· (17)
第2章 關係資料庫理論····························· (21)
2.1 關係模型································ (21)
2.1.1 關係模型的基本概念························· (21)
2.1.2 關係模式······························ (23)
2.2 關係模型的完整性···························· (23)
2.3 關係代數································ (24)
2.3.1 關係代數概述···························· (24)
2.3.2 關係代數的基本操作························· (24)
2.3.3 關係代數的其他操作························· (27)
2.4 關係資料庫規範化理論·························· (28)
2.4.1 關係規範化理論概述························· (28)
2.4.2 函式依賴······························ (30)
2.4.3 關係的規範化···························· (32)
2.4.4 多值依賴與第四範式························· (34)
2.4.5 各種範式之間的關係························· (35)
2.5 小結·································· (36)
習題2···································· (36)
第3章 關係資料庫語言SQL··························· (41)
3.1 SQL語言的功能與特點·························· (41)
3.2 表的基本操作······························ (41)
3.2.1 定義表······························· (41)
3.2.2 修改表······························· (44)
3.2.3 刪除基本表····························· (45)
3.3 SQL的數據查詢····························· (45)
3.3.1 單表查詢······························ (46)
3.3.2 多表查詢······························ (52)
3.4 SQL的視圖操作····························· (54)
3.4.1 定義視圖······························ (54)
3.4.2 創建視圖······························ (54)
3.4.3 使用視圖······························ (55)
3.4.4 刪除視圖······························ (56)
3.5 子查詢································· (56)
3.6 組合查詢································ (58)
3.7 數據的插入、修改與刪除························· (59)
3.7.1 插入數據······························ (59)
3.7.2 修改數據······························ (60)
3.7.3 刪除數據······························ (60)
3.8 小結·································· (61)
習題3···································· (61)
第4章 SQL Server 2005套用基礎························· (66)
4.1 SQL Server 2005系統概述························· (66)
4.2 SQL Server 2005版本說明························· (67)
4.3 SQL Server 2005 Express Edition簡介····················· (68)
4.4 SQL Server 2005安裝與配置························ (70)
4.4.1 安裝時考慮的關鍵點························· (70)
4.4.2 SQL Server 2005 Express Edition安裝··················· (71)
4.4.3 SQL Server 2005組件························· (77)
4.5 常見故障分析······························ (80)
4.6 資料庫的創建······························ (80)
4.6.1 作業系統檔案···························· (80)
4.6.2 資料庫檔案組···························· (81)
4.6.3 使用數據檔案和檔案組的建議····················· (81)
4.6.4 創建資料庫····························· (81)
4.6.5 修改資料庫····························· (84)
4.6.6 刪除資料庫····························· (85)
4.7 基本表的定義······························ (85)
4.7.1 創建基本表····························· (85)
4.7.2 修改基本表····························· (89)
4.7.3 刪除基本表····························· (91)
4.8 索引的建立和刪除···························· (91)
4.8.1 索引的概念····························· (91)
4.8.2 索引的類型····························· (91)
4.8.3 建立索引······························ (92)
4.8.4 刪除索引······························ (92)
4.9 小結·································· (92)
習題4···································· (93)
第5章 SQL高級套用······························ (94)
5.1 Transact_SQL······························ (94)
5.1.1 Transact_SQL簡介·························· (94)
5.1.2 Transact_SQL語法格式························ (94)
5.1.3 Transact_SQL 系統元素························ (96)
5.2 Transact_SQL程式流程控制························ (99)
5.2.1 IF...ELSE語句···························· (99)
5.2.2 BEGIN...END語句························· (100)
5.2.3 GOTO語句···························· (101)
5.2.4 WHILE、BREAK、CONTINUE語句·················· (101)
5.2.5 WAITFOR語句··························· (101)
5.2.6 RETURN語句··························· (102)
5.2.7 CASE表達式···························· (102)
5.3 存儲過程································ (103)
5.3.1 存儲過程的概念·························· (103)
5.3.2 存儲過程的創建與執行························ (104)
5.3.3 存儲過程與參數·························· (108)
5.4 觸發器································· (110)
5.4.1 觸發器的概念與工作原理······················· (110)
5.4.2 創建觸發器···························· (111)
5.4.3 管理觸發器···························· (114)
5.4.4 觸發器的用途··························· (115)
5.5 小結·································· (115)
習題5··································· (115)
第6章 資料庫設計······························· (116)
6.1 資料庫設計的內容與特點························· (116)
6.2 資料庫設計方法····························· (116)
6.3 資料庫設計步驟····························· (117)
6.4 資料庫規劃······························· (118)
6.5 需求分析································ (118)
6.5.1 需求分析的任務·························· (118)
6.5.2 需求分析的方法·························· (119)
6.5.3 需求分析的步驟·························· (119)
6.6 概念結構設計······························ (122)
6.6.1 設計各局部套用的E-R模型······················ (122)
6.6.2 全局E-R模型的設計························· (122)
6.7 邏輯結構設計······························ (124)
6.7.1 邏輯結構設計的步驟························· (124)
6.7.2 E-R圖向關係模型的轉換······················· (124)
6.7.3 邏輯模式的最佳化·························· (125)
6.7.4 外模式的設計··························· (126)
6.8 物理結構設計······························ (127)
6.8.1 資料庫物理結構設計的內容與方法··················· (127)
6.8.2 關係模式存取方法的選擇······················· (127)
6.8.3 系統存儲結構的確定························· (129)
6.9 資料庫的實施······························ (130)
6.9.1 資料庫試運行··························· (131)
6.9.2 資料庫的運行與維護························· (131)
6.10 資料庫套用的結構和開發環境······················ (132)
6.10.1 資料庫套用模型·························· (132)
6.10.2 資料庫套用開發環境ODBC····················· (134)
6.11 小結································· (137)
習題6··································· (137)
第7章 資料庫保護技術····························· (140)
7.1 事務機制································ (140)
7.1.1 事務的概念與特性·························· (140)
7.1.2 事務的提交與回退·························· (141)
7.2 資料庫安全性······························ (142)
7.2.1 對資料庫安全的威脅························· (142)
7.2.2 資料庫安全性控制·························· (143)
7.2.3 視圖機制····························· (144)
7.2.4 數據加密····························· (144)
7.2.5 SQL Server 2005的安全性······················· (144)
7.3 資料庫完整性······························ (147)
7.3.1 資料庫完整性概述·························· (147)
7.3.2 完整性控制···························· (148)
7.3.3 數據完整性的實現·························· (150)
7.4 資料庫恢復······························· (153)
7.4.1 資料庫的故障分類·························· (153)
7.4.2 資料庫故障的基本恢複方式······················ (154)
7.4.3 恢復策略····························· (156)
7.4.4 具有檢查點的恢復技術························ (158)
7.4.5 SQL Server 2005備份與還原······················ (159)
7.5 並發控制································ (163)
7.5.1 資料庫並發操作帶來的數據不一致性問題················ (163)
7.5.2 封鎖技術····························· (165)
7.5.3 鎖協定······························ (165)
7.5.4 封鎖帶來的問題——活鎖與死鎖···················· (166)
7.5.5 並發調度的可串列性························· (168)
7.5.6 SQL Server的並發控制························ (170)
7.6 小結·································· (171)
習題7··································· (172)
第8章 資料庫訪問技術····························· (176)
8.1 ODBC的使用······························ (176)
8.1.1 ODBC概述···························· (176)
8.1.2 ODBC數據源的配置························· (177)
8.2 ADO的使用······························· (179)
8.2.1 ADO概述····························· (179)
8.2.2 使用ADO技術訪問資料庫舉例···················· (181)
8.3 ADO簡介····························· (184)
8.3.1 ADO技術的設計目標······················ (184)
8.3.2 ADO的體系結構························ (184)
8.3.3 ADO數據對象························· (190)
8.4 JDBC技術······························· (191)
8.4.1 JDBC概述····························· (191)
8.4.2 JDBC驅動程式··························· (192)
8.4.3 JDBC常用類···························· (193)
8.5 小結·································· (194)
習題8··································· (194)
第9章 C語言資料庫應用程式開發························ (195)
9.1 嵌入式SQL語句····························· (195)
9.1.1 在C語言程式中嵌入SQL語句的程式開發環境的搭建··········· (196)
9.1.2 第一個在C語言程式中嵌入SQL語句的程式··············· (197)
9.2 靜態SQL語句······························ (199)
9.2.1 聲明嵌入式SQL語句中使用的C變數·················· (199)
9.2.2 連線資料庫···························· (201)
9.2.3 數據的查詢與更新·························· (202)
9.2.4 SQL通信區···························· (203)
9.3 動態SQL語句······························ (205)
9.3.1 動態修改····························· (205)
9.3.2 動態游標····························· (206)
9.3.3 SQLDA······························ (208)
9.4 C語言資料庫應用程式開發實例······················ (209)
9.4.1 需求說明····························· (209)
9.4.2 資料庫結構設計·························· (209)
9.4.3 資料庫行為設計·························· (210)
9.4.4 系統實現····························· (210)
習題9··································· (215)
第10章 C#資料庫應用程式開發··················· (216)
10.1 資料庫的連線····························· (216)
10.1.1 SqlConnection的使用························ (217)
10.1.2 OleDbConnection的使用······················ (218)
10.1.3 OdbcConnection的使用······················· (219)
10.1.4 OracleConnection的使用······················ (220)
10.2 數據的獲取······························ (223)
10.2.1 創建Command對象························ (223)
10.2.2 執行命令···························· (223)
10.2.3 參數化查詢··························· (227)
10.2.4 執行存儲過程·························· (229)
10.3 DataReader的使用··························· (231)
10.3.1 DataReader簡介·························· (231)
10.3.2 使用DataReader讀取數據······················ (232)
10.3.3 在DataReader中使用多個結果集··················· (234)
10.4 DataSet和DataAdapter的使用······················ (236)
10.4.1 DataSet簡介··························· (236)
10.4.2 DataAdapter簡介························· (236)
10.4.3 利用DataSet和DataAdapter訪問數據················· (237)
10.4.4 類型和無類型DataSet······················· (239)
10.5 性能································· (240)
10.6 C#資料庫應用程式開發實例······················· (240)
10.6.1 需求說明···························· (241)
10.6.2 資料庫結構設計·························· (241)
10.6.3 資料庫行為設計·························· (242)
10.6.4 系統實現···························· (242)
習題10··································· (244)
第11章 Java資料庫應用程式開發························ (245)
11.1 JDBC API簡介····························· (245)
11.2 SQL和Java之間的映射關係······················· (246)
11.3 JDBC編程······························· (247)
11.3.1 資料庫操作基本步驟························ (248)
11.3.2 JDBC資料庫操作實現······················· (249)
11.4 連線其他類型資料庫·························· (267)
11.4.1 連線Oracle資料庫························· (267)
11.4.2 連線MySQL資料庫························ (268)
11.4.3 連線SQL Server資料庫······················· (269)
11.4.4 JDBC:ODBC連線Access資料庫··················· (271)
11.5 Java資料庫應用程式開發實例······················ (272)
11.5.1 需求說明···························· (272)
11.5.2 資料庫結構設計·························· (273)
11.5.3 資料庫行為設計·························· (273)
11.5.4 系統實現···························· (274)
習題11··································· (279)
第12章 資料庫新技術····························· (282)
12.1 面向對象資料庫系統·························· (282)
12.1.1 對象-關係資料庫························· (284)
12.1.2 面向對象資料庫與傳統資料庫的比較················· (284)
12.2 分散式資料庫系統··························· (286)
12.2.1 分散式資料庫系統概述······················· (286)
12.2.2 分散式資料庫系統的設計······················ (288)
12.2.3 分散式資料庫系統的安全技術···················· (289)
12.2.4 分散式資料庫系統的發展前景與套用趨勢··············· (289)
12.3 數據倉庫······························· (291)
12.3.1 數據倉庫的定義與特點······················· (291)
12.3.2 數據倉庫的種類·························· (292)
12.3.3 數據集市···························· (292)
12.3.4 數據倉庫中的幾個數據······················· (293)
12.3.5 數據倉庫模型·························· (294)
12.4 數據挖掘······························· (295)
12.4.1 數據挖掘的定義·························· (295)
12.4.2 數據挖掘的分類·························· (295)
12.4.3 數據挖掘的數據來源························ (295)
12.4.4 數據挖掘的體系結構························ (296)
12.4.5 數據挖掘的步驟·························· (296)
12.4.6 數據挖掘的功能·························· (296)
12.4.7 數據挖掘的常用技術························ (296)
12.5 資料庫技術的新套用·························· (297)
12.5.1 數據模型研究·························· (297)
12.5.2 與新技術結合的研究························ (297)
12.5.3 與套用領域結合的研究······················· (300)
12.6 小結································· (302)
習題12··································· (302)
附錄A 實驗部分································ (303)
附錄B 課程設計指導書····························· (317)
參考文獻···································· (323)
文摘 數據結構是刻畫一個數據模型性質最重要的方面。因此,在資料庫系統中,通常按照數據結構的類型來命名數據模型。例如,層次結構、網狀結構、關係結構的數據模型分別命名為層次模型、網狀模型和關係模型。(2)數據操作。數據操作用於描述系統的動態特徵。數據操作是指允許對資料庫中各種對象(型)的實例(值)執行的操作的集合,包括操作及有關的操作規則。資料庫主要有檢:索和修改(包括插入、刪除、更新)兩大類操作。數據模型必須定義這些操作的確切含義、操作符號、操作規則(如優先權)及實現操作的語言。
文摘
(3)數據完整性約束。數據完整性約束是一組完整性規則的集合。完整性規則是給定的數據模型中數據及其聯繫所具有的制約和存儲規則,用以限制符合數據模型的資料庫狀態及狀態的變化,用以確保數據的正確、有效和相容。
數據模型應該反映和規定本數據模型必須遵守的、基本的、通用的完整性約束。例如,在關係模型中,任何關係必須滿足實體完整性和參照完整性這兩類約束。
此外,數據模型還應該提供定義完整性約束的機制,以反映具有套用所涉及的數據必須遵守的特定的語義約束。例如,在教師信息中的“性別”屬性只能取值為男或女,教師任課信息中的“課程號”屬性的值必須取自學校已經開設的課程等。
1.3.2 概念數據模型
概念數據模型,有時也簡稱概念模型。概念數據模型是按用戶的觀點對現實世界中的數據建模的,是一種獨立於任何計算機系統的模型,完全不涉及信息在計算機系統中的表示,也不依賴於具體的資料庫管理系統。只是用來描述某個特定組織所關心的信息結構。它是對現實世界的第一層抽象,是用戶和資料庫設計人員之間交流的工具。
概念數據模型是理解資料庫的基礎,也是設計資料庫的基礎。