Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Database Systems 高海昌 [email protected] DataBase System Major Content & Grade Introduction * The *** Relational Model SQL **** Transaction Management *** Database Design (E-R) *** Database Design (Normalization) *** 考核方式 笔试(70%)+平时(课堂/作业/上机) (30%) Haichang Gao , Software School , Xidian University 2 DataBase System Books Book Abraham Silberschatz, Henry F. Korth, S.Sudarshan, Database System Concepts (5th ed.), The McGraw-Hill Companies, 2006 Reference Books Thomas M. Connolly, et al. Database Systems: A practical approach to Design, Implementation, and Management. 4th edition, Addison-Wesley, 2008 萨师煊,王珊 《数据库系统概论》 高等教育出版社 (第4版) Haichang Gao , Software School , Xidian University 3 DataBase System Unit 1 Introduction Data & Database DBMS Database System Database Applications Brief History of Data Management Haichang Gao , Software School , Xidian University 4 DataBase System Data & Database How to management Information (Data)? data: data are raw facts that describe people, objects, and events. Haichang Gao , Software School , Xidian University 5 DataBase System Data & Database How to management Information(Data)? Database : An integrated collection of related data constitutes a Database (DB). Haichang Gao , Software School , Xidian University 6 DataBase System DBMS Database Management System (DBMS) : Contains information about a particular enterprise Collection of interrelated data Set of programs to access the data An environment that is both convenient and efficient to use Application1 Database Application2 DBMS …… Haichang Gao , Software School , Xidian University 7 DataBase System DBMS What should A DBMS needed? Data can be shared Redundancy(冗余) can be reduced Inconsistency(不一致性) can Transaction(事务) support be avoided can be provided Integrity(完整性) can be maintained Security(安全性) can be enforced Conflicting(冲突) requirements can Standards be balanced can be enforced DBMS is less complex than OS. Haichang Gao , Software School , Xidian University 8 DataBase System DBMS Architecture 成绩单 学号:xxxxx 姓名:xxx 性别:x 离散数据 75 数据库系统 81 …… …… 模式(Logical Schema, Sno Sname Ssex Sage Sdept Schema,也称逻辑模式) ——数据库中全体数据的逻辑 Sno Cno 结构和特征(型)的描述 外模式(External Schema, 也称子模式或用户模式) ——数据库用户使用的局部数据 的逻辑结构和特征的描述 Cno Cname Cpno Ccredit Grade 内模式(Physical Schema, 也称存储模式) ——数据物理结构和存储方式 的描述 Haichang Gao , Software School , Xidian University 9 DataBase System DBMS Architecture ANSI/SPARC architecture Haichang Gao , Software School , Xidian University 10 DataBase System Functions of DBMS 1) Data definition(Data Definition Language—DDL) 利用DDL可方便地对数据库中的数据对象进行定义。 2) Data manipulation(Data Manipulation Language—DML) 用户利用DML实现对数据库数据的基本操作,如查询、插入、删 除和修改等。 3) Database running management 在数据库的建立、运行和维护时,由DBMS进行统一管理、统一 控制,以确保数据的安全性、完整性、多用户的并发操作及发生故障 后的系统恢复。 4) Database establish and maintain 数据库初始数据的录入、转换功能、数据库的转储、恢复功能、 数据库的重组织和性能监视、分析功能等。一般由DBMS中的一些实 用程序完成。 Haichang Gao , Software School , Xidian University 11 DataBase System Database System Database System: A computerized record-keeping systems, composed by Data, Hardware, Software and People User User User Application Development Tools DBMS DBA OS DB Haichang Gao , Software School , Xidian University 12 DataBase System Components of Database System Data Anything that is of significance to the individual or organization concerned Two characters integrated - needn’t include redundant information shared – a record file should be shared by different user Multi-views Hardware Secondary storage volume I/O device, Device controller, I/O channel, etc Processor and Main memory Haichang Gao , Software School , Xidian University 13 DataBase System Components of Database System Software OS Unix,Linux, OS/2, Windows NT … Database Management System Oracle, DB2, Sybase, MySQL, PostgreSQL, … Others software utilities, application development tools, designs aid, report writer, transaction manager Haichang Gao , Software School , Xidian University 14 DataBase System Components of Database System People End users—Interactive users. Casual users (临时用户):facility with SQL… Naive users (初级用户): bank clerks… Application programmers An application programmer, in the sense used with DBMS, writes the menu applications used by naive users. DBA (database administrator) A DBA is a computer professional responsible for the design and maintenance of the database. Haichang Gao , Software School , Xidian University 15 DataBase System 题外:数据库领域的三位图灵奖得主 Charles W. Bachman(查尔斯 • 巴赫曼) 1973 主持设计与开发了最早的网状数据库管理系统 IDS,它的设计思想和技术直接影响了后来的 数据库。他还促成了数据库标准的制定,即 DDL和DML规范说明。 Edgar F. Codd(埃德加 • 科德) 1981 于1970年6月发表了题为“A Relational Model of Data for Large Shared Data Banks”一文,首次 明确而清晰地为数据库系统提出了一种崭新的模 型,即关系模型。一经提出迅速商品化。 James Gray(詹姆斯 • 格雷) 1998 在事务处理技术上的创造性思维和开拓性工作, 使他成为该技术领域公认的权威。在解决保障 数据的完整性、安全性、并行性,以及从故障 中恢复方面发挥了十分关键的作用。 Haichang Gao , Software School , Xidian University 16 DataBase System Unit 1 Introduction Data & Database DBMS Database System Database Applications Brief History of Data Management Haichang Gao , Software School , Xidian University 17 DataBase System Database Applications Database contains information about a particular enterprise. Database Applications: Banking: all transactions Airlines: reservations, schedules Universities: registration, grades Sales: customers, products, purchases Manufacturing: Human production, inventory, orders, supply chain resources: employee records, salaries, tax deductions …… Databases touch all aspects of our lives Haichang Gao , Software School , Xidian University 18 DataBase System Database Applications Architecture Client/Server architecture Haichang Gao , Software School , Xidian University 19 DataBase System Database Applications Architecture Browser/Server architecture Haichang Gao , Software School , Xidian University 20 DataBase System Brief History of Data Management In the early days(Before 1960s), database applications were built on top of FILE systems Prog1 Prog2 Progn File1 File System File2 Filen Haichang Gao , Software School , Xidian University 21 DataBase System Brief History of Data Management Drawbacks of using FILE SYSTEMS : Data redundancy and inconsistency(不一致性) Difficulty in Data accessing data isolation Integrity problems Atomicity of updates Concurrent Security access by multiple users problems It’s impossible to programmers for even ONE solution! Haichang Gao , Software School , Xidian University 22 DataBase System Brief History of Data Management Management using DBMS Database systems offer solutions to all the above problems in using file systems ! Prog1 DB Prog2 DBMS Progn Haichang Gao , Software School , Xidian University 23 DataBase System History of Database System Hierarchical system (1960s) IBM’s IMS data represent to user is the form of tree structure IMS provided the hierarchical data model, where different kinds of records relate to one another in a hierarchical form. data shared by several applications R1 R2 R4 R3 R5 Haichang Gao , Software School , Xidian University 24 DataBase System Example of Hierarchical system 学院 教研室 D01 通信工程 主楼II区 R0101 信息科学研究所 D02 电子工程 主楼III区 R0102 信息保密研究所 D03 计算机 主楼I区 …… …… …… R0301 应用教研室 R0302 软件实践中心 …… …… R0303 软件教研室 …… 教师 用指针实现记 录间的联系! E0102 王大明 男 E0103 李明丽 女 …… …… …… E0313 陈芝 女 E0315 孟正堂 男 …… …… …… …… Haichang Gao , Software School , Xidian University 25 DataBase System History of Database System Network System (1960s) Cullinet Software IDMS (CODASYL DBTG Report) The network data model, a generalization of the hierarchical model where a set of record in one layer might have two different containing hierarchies at the next layer up. Bachman data represent to user is graph structure operator similar to hierarchical system Haichang Gao , Software School , Xidian University 26 DataBase System Example of Network System S S001 S002 S003 …… SC 李小明 张娜 王杰 …… CS CS CS … S001 S001 S002 S002 S003 S003 …… C C01 C02 C01 C02 C01 C02 ….. 80 78 65 84 91 85 … … C01 高等数学 3 C02 计算机原理 4 … …… … … Haichang Gao , Software School , Xidian University 27 DataBase System History of Database System Relational system (1970s) data representation are table, operator generate new tables from old tables In a relational database, all information is represented in the form of named tables (relation) with labeled column (attribute) In the relational model, a column of a table must contain a single, unstructured value(first normal form rule) Products : SQL server, Oracle, Sybase, DB2, Informix, Ingres, etc. Codd Haichang Gao , Software School , Xidian University 28 DataBase System Example of Relational System enrollment (注册) students sid 1 2 3 4 lname Jones Smith Brown White fname Allan John Harry Edward class 2 3 2 3 tel 88201234 88201233 88202255 88201688 courses cno 101 102 105 108 cname English I English II Math Chinese croom I-101 I-102 II-101 II-202 sid cno major 1 1 2 3 3 4 4 101 108 105 101 108 102 105 No Yes No Yes No No No time MW2 MW3 MW2 MW4 Haichang Gao , Software School , Xidian University 29 DataBase System History of Database System Object-Relational system (1980s) In an object-relational database, information is still represented as in the relational model in the form of named tables with labeled columns but the column values are no longer restricted by the First Normal Form rule (can be STRUCT or SET datatype). Haichang Gao , Software School , Xidian University 30 DataBase System Example of ORDBMS students name Sid enrollment class lname tel fname cno 1 Jones Allan 2 88201234 2 3 Smith Brown John Harry 3 2 88201233 88202255 4 White Edward 3 88201688 101 108 105 101 108 102 105 major No Yes No Yes No No No courses cno 101 102 105 108 cname English I English II Math Chinese croom I-101 I-102 II-101 II-202 time MW2 MW3 MW2 MW4 Haichang Gao , Software School , Xidian University 31 DataBase System History of Database System 1990s: Large decision support and data-mining applications Large multi-terabyte data warehouses Emergence of Web commerce 2000s: XML and XQuery standards Automated database administration Haichang Gao , Software School , Xidian University 32