版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Introduction to Database SystemsRuoming JinTTH 9:15 10:30pmSpring 2021rm MSB115Course GoalsThis course is an introduction to the design, use, and internal workings of database management system. Understanding Relational Model/Algebra: data is represented as a set of two dimensional tables and operat
2、ors are defined by manipulate the data. Mastering SQL programming and mySQL database: you will master the operations on a database system. Database design: how to build a real database for an real application? Web+Database: PHP and C+ access of mySQL. Database System Implementation: Storage/Indexing
3、/Transactions 1 & 5 separate a CS major with an IT professional 1, 2, 5 are the basics of a database system. ReferencesA. Silberschatz, H. F. Korth, S Sudarshan, Database System Concepts, 5th Ed., McGrow Hill, 2005Hector Garcia-Molina, Jeffrey D. Ullman, Jennifer Widom, Database Systems, The Complet
4、e Book, Prentice Hall, 2002 ://ullman/dscb.htmlClass notesPrerequisitesCS 33001 Data StructuresCS31011 Discrete StructuresStructured Programming Language (C+)Software engineering topics related to project documentation and project designWorkload & RequirementsProject3 Exams during
5、 the semester and Final ExamProject 20% of the final grade 2 Exams 15% of the final grade per each exam 1 Exam 20% of the final grade Final 25% of the final grade Attendance 5%No late projects are acceptedA 91 100; B 80-90; C 7079; D - 64 Class ScheduleWeek 1 Database OverviewWeek 2,3 Relational Mod
6、el (exam 1) Week 4,5,6 SQL+ mySQL database (2 labs+exam 2) Week 7,8, 9 ER model+ Relational Database Design Theory (1 lab+ exam 3) - project assignmentWeek 10, 11,12 PHP programming + C+ database access (1 lab) Web 13, 14,15 Advanced topic (indexing/Query Procesing/Transaction management) + (1 lab)
7、Database OverviewFile Management vs Database Management (why do we need database?) Advantages of Database systems: storage persistence, programming interface, transaction managementData Model (What is Data?) Database Language (How to manipulate data?) DBMS Architecture and Database System Components
8、 (How can you build a billion-dollar software, like Oracle? Or you can get it free, mySQL?) Users classification (What you can do and what you cannot do?) Where are databases?You cannot avoid it and its everywhere!You can say it actually makes the current society and your life work!Banking/Credit ca
9、rd /Social Security InfoOnline shopping/bookingThe DBMS MarketplaceRelational DBMS companies Oracle, Sybase are among the largest software companies in the world.IBM offers its relational DB2 system. With IMS, a nonrelational system, IBM is by some accounts the largest DBMS vendor in the world.Micro
10、soft offers SQL-Server, plus Microsoft Access for the cheap DBMS on the desktop, answered by “lite systems from other competitors.OpenSource: mySQL, postgreSQLPre-Database Era: Stone Age of Data Imagine you want build an online shopping websiteMaintain products/categories (price, picture, properties
11、, )Customers accounts File is uninterpreted, unstructured collection of informationFile operations: delete, catalog, create, rename, open, close, read, write, find, Access methods: Algorithms to implement operations along with internal file organizationExamples: File of Customers, File of Products;
12、Access method: implementation of a set of operations on those filesC+ file programmingopen - open a file- specify how its opened (read/write) and type (binary/text) close - close an opened file read - read from a file write - write to a file seek - move a file pointer to somewhere in a file File Man
13、agement System ProblemsAny question (access) on the data is a small program! Data redundancyData is not isolated from the access implementation (different format) Multiple application (concurrent program) on the same fileConcurrent Program ExecutionProgram1What is the final value of the account AC?P
14、rogram2AC=AC-50AC=AC-100AC #103 450Security ProblemsAllow access to the file only to the authorized personnelAbility to restrict access to parts of the recordAbility to control operation usage by different usersProtection from unauthorized useProtection from the derivation of unauthorized informatio
15、nData IntegrityA database constraint is a logical constraint about the data expressed in a logical language. STUDENT.AGE 15If (STUDENT.CLASS =cs43005) then (STUDENT.PRIOR_CLASS =cs31001)Database is consistent if data at each time satisfies all integrity constraints. Input to any application is a set
16、 of consistent data. An application output is a set of consistent data.Collection of FilesHierarchical 60s70s80s90snowRelationalChoice for most new applicationsObject BasesKnowledge BasesNetworkAdvantages of DatabasesPersistent Storage Database not only provides persistent storage but also efficient
17、 access to large amounts of dataProgramming Interface Database allows users to access and modify data using powerful query language. It provides flexibility in data managementTransaction Management Database supports a concurrent access to the data Early Database ApplicationsAirline Reservation Syste
18、ms Data items are: single passenger reservations; Information about flights and airports; Information about ticket prices and tickets restrictions. Banking Systems Data items are accounts, customers, loans, mortgages, balances, etc. Failures are not tolerable. Concurrent access must be providedCorpo
19、rate Records Data items are: sales, accounts, bill of materials records, employee and their dependentsModern Database ApplicationsClient Server architectureDBMS serves as a server and client queries are sent to serversWhere to locate serversMultimedia ApplicationsMultidatabase ApplicationsData Wareh
20、ousesIts everywhere!Three Aspects to Studying DBMSs1. Modeling and design of databases.Allows exploration of issues before committing to an implementation.2. Programming: queries and DB operations like update.3. DBMS implementation.What Is Data ?Different view points:A sequence of characters stored
21、in computer memory or storageInterpreted sequence of characters stored in computer memory or storageInterpreted set of objectsThis maybe one of the most profound questions in computer science! It is still open and keep evolving! Data Levels and their RolesPhysical corresponds to the first view of da
22、ta: How data is stored, how is it accessed, how data is modified, is data ordered, how data is allocated to computer memory and/or peripheral devices, how data items are actually represented (ASCI, EBCDIC,)Conceptual corresponds to the second view of data: What we want the data to express and what r
23、elationships between data we must express, what “ story data tells, are all data necessary for the “story are discussed.View corresponds to the third view of data:What part of the data is seen by a specific applicationPhysical Data - ExamplePhysicalbenjamin631030000035000Jjames610336000375. . . . .
24、. . . . ExamplesConceptualTA Name char(10), Age char (3), Salary Fixed Dec(6); - Student Name char(10), Year-of_study char(3) GPA Fixed Dec(5,2);Examples- STUDENTS-TA Name char(25), Age char (3), Salary Fixed Dec(8,2), Year-of_study char(3) GPA Fixed Dec(3,2);A viewThree Level Data View Data Abstrac
25、tionsView1 View kConceptual View Of DataPhyisal Data Storage. . . . .Logical Data ModelsA collection of tools for describing data data relationshipsdata semanticsdata constraintsA Break-through : Relational ModelAn enterprise is represented as a set of relationsDomain is a set of atomic values. Each
26、 domain has a NULL value.Data type Description of a form that domain values can be represented. Relation is a subset of a cartesian product of one or more domainsThe elements of relations are called tuples. Each element in the cartesian product is called attribute.Relational ModelExample of tabular
27、data in the relational modelNameStudent-idStreetCitygpaJohnsonSmithJohnsonJonesSmith192-83-7465019-28-3746192-83-7465321-12-3123019-28-3746AlmaNorthAlmaMainNorthPalo AltoRyePalo AltoHarrisonRye4.03.45AttributesObject Oriented ModelAn enterprise is described as a collection of objects and a
28、collection of algorithms that work with objectsExample: Person is an object.Object is characterized by a set of public attributes. Applications may refer only to public attributes; private attributes . Algorithms that implement the object may refer to private attributes; a set of protected attribute
29、s and a set of methodsAttribute of an object can be another objectObjects are nested into a hierarchy and can inherit attributes of their parentsObject Oriented ModelOBJECT DATA MODEL1.Complex Objects Nested Structure (pointers or references)2.Encapsulation, set of Methods/Access functions3.Object I
30、dentity4.Inheritance Defining new classes like old classesObject model: usually find objects via explicit navigationAlso query language in some systemsExampleClass Person public: Person(); Person(); float GetSalary(); float PutSalary(float&); string Name; int SSN; date BirthDate; private: float sala
31、ry; Object-Oriented ModelData EncapsulationAn object contains both data and methods to work with the dataThe physical data representation is visible only to the object creator.The implementation details of methods are not visible to object usersAn interface of the object consists of public attribute
32、s and methodsEach object is characterized by an object identityData Manipulation LanguageLanguage for accessing and manipulating the data organized by the appropriate data modelTwo classes of languages Procedural user specifies what data is required and how to get those data Nonprocedural user speci
33、fies what data is required without specifying how to get those dataSQL is the most widely used query languageDatabase LanguagesFacultyNameDeptDepartmentDeptChairSQLSELECT Chair FROM Faculty, DepartmentWHERE F = “Ken NonameAND Faculty.Dept = Department.DeptData definition language (DDL) li
34、ke type definitions in C or C+Data Manipulation Language (DML)Query (SELECT)UPDATE SET = WHERE Data Definition LanguageSpecification notation for defining the database schemaE.g. create table account ( account-number char(10), balance integer)DDL compiler generates a set of tables stored in a data d
35、ictionaryData dictionary contains metadata (i.e., data about data) database schema Data storage and definition language language in which the storage structure and access methods used by the database system are specifiedUsually an extension of the data definition language Database Host Languages C,
36、C+, Fortran, Lisp, COBOLApplication prog.Local VarsDBMSCalls toDBHost language is completely general Query languageless general non procedural andoptimizable(Memory)(Storage)Database Definition A database is a collection of stored operational data used by various applications and/or users by some pa
37、rticular enterprise or by a set of outside authorized applications and authorized usersA DataBase Management System (DBMS) is a software system that manages execution of users applications to access and modify database data so that the data security, data integrity, and data reliability is guarantee
38、d for each application and each application is written with an assumption that it is the only application active in the database.DBMS Architecture Logical and Physical Database ComponentsData Definition Language (DDL)Data Manipulation Language (DML)Host Language InterfaceData AdministratorUsersQuery
39、 ProcessorCompilerOptimizerManagementTransaction ManagerFile ManagerBuffer ManagerAuthorization and Integrity ManagerLogicalPhysicalQuery ProcessorCompiler verifies whether a program or query is written in accordance with DDL and DML rulesOptimizer Finds the most effective way to access the required
40、 data and supply it in a user requested form. Monitors the query execution and modifies a query evaluation plan if necessary.Storage ManagementStorage manager is a program module that provides the interface between the low-level data stored in the database and the application programs and queries su
41、bmitted to the system.The storage manager is responsible to the following tasks: interaction with the file manager efficient storing, retrieving and updating of data Transaction ManagerA transaction is a collection of operations that performs a single logical function in a database applicationTransa
42、ction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures.Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the cons
43、istency of the database.File ManagerFile Manager is responsible for mapping logical database units (objects, relations, etc.) into a set of low level files.It is responsible for maintenance of files and indexes on them. It should be able to create and destroy index and collect unused storage space t
44、o eliminate an unneeded gaps on disks.Buffer ManagerBuffer Manager is responsible for the allocation and maintenance buffer space in a memory to facilitate processing database data by several concurrent applications.Buffer Manager decides when to load data from a buffer to a database or discard the
45、data and under what conditions a new data should be put into a bufferAuthorization and Integrity ManagerThis manager is responsible for granting an access to database or portions thereof only to authorized users and preventing the access to unauthorized usersIntegrity manager must assure data integr
46、ity during normal database operations as well as during the database failuresData AdministratorCoordinates all the activities of the database system; the database administrator has a good understanding of the enterprises information resources and needs.Database administrators duties include:Schema d
47、efinitionStorage structure and access method definitionSchema and physical organization modificationGranting user authority to access the databaseSpecifying integrity constraintsActing as liaison with usersMonitoring performance and responding to changes in requirementsDatabase UsersNave do not know
48、 about database too much, invoke application programs that are prepared alreadyApplication Programmers know how to interact with the system but may not know how DBMS is designedSophisticated users that know advanced use of the system and can use the system and packages on the top of the systemDBMS s
49、ystem users write specialized database applications that do not fit into the traditional data processing framework A Little Design Methodology: Entity-Relationship ModelThe enterprise data can be described as a set of entities and a set of relationships between them.Entity a data that pertains to, o
50、r describes some component of the enterpriseEach entity is characterized by a set of attributesRelationship describes an interconnection between different entitiesEntity Set a set of entities that are characterized by the same entity definitionRelationship Set a set of relationships of the same type
51、 Entity-Relationship ModelExample of schema in the entity-relationship modelRfOcL9H6E2B+y(u%r#oWlThQeNbJ8G5D1A-x*t$qYnVkSgPdMaI7F3C0z)v&s!pXmUiRfOcK9H6E2B+x(u%rZoWlThQeMbJ8G4D1A-w*t!qYnVjSgPdLaI6F3C0y)v&s#pXlUiRfNcK9H5E2B+x(u$rZoWkThQeMbJ7G4D1z-w*t!qYmVjSgOdLaI6F3B0y)v%s#pXlUiQfNcK8H5E2A+x*u$rZnWkTh
52、PeMaJ7G4C1z-w&t!qYmVjRgOdL9I6F3B0y(v%s#oXlUiQfNbK8H5D2A+x*u$qZnWkShPeMaJ7F4C1z)w&t!pYmUjRgOcL9I6E3B+y(v%r#oXlTiQfNbK8G5D2A-x*u$qZnVkShPdMaJ7F4C0z)w&s!pYmUjRfOcL9H6E3B+y(u%r#oWlTiQeNbJ8G5D1A-x*t$qYnVkSgPdMaI7F3C0z)v&s!pXmUjRfOcK9H6E2B+y(u%rZoWlThQeNbJ8G4D1A-w*t$qYnVjSgPdLaI7F3C0y)v&s#pXmUiRfNcK9H5E2B
53、+x(u$rZoWkThQeMbJ8G4D1z-w*t!qYnVjSgOdLaI6F3C0y)v%s#pXlUiRfNcK8H5E2A+x(u$rZnWkThPeMbJ7G4C1z-w&t!qYmVjRgOdL9I6F3B0y(v%s#oXlUiQfNcK8H5D2A+x*unVjSgOdLaI6F3C0y)v%s#pXlUiRfNcK8H5E2A+x(u$rZnWkThPeMbJ7G4C1z-w&t!qYmVjSgOdL9I6F3B0y)v%s#oXlUiQfNcK8H5D2A+x*u$rZnWkShPeMaJ7G4C1z)w&t!pYmVjRgOcL9I6E3B0y(v%r#oXlTiQf
54、NbK8H5D2A-x*u$qZnWkShPdMaJ7F4C1z)w&s!pYmUjRgOcL9H6E3B+y(v%r#oWlTiQeNbK8G5D1A-x*t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. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2027年业务用人合同二篇
- 2027年个人房屋翻修合同二篇
- 做账实操-建筑劳务人工成本会计处理标准操作流程
- 合规转利润:降本增效全指南(2026)《GBT 36060-2018精装书籍用水基胶黏剂粘接过程控制要求及检验方法》
- 口述影像讲述员安全意识强化模拟考核试卷含答案
- 磁选工安全素养考核试卷含答案
- 燃气具安装工班组安全水平考核试卷含答案
- 石质文物修复师成果测试考核试卷含答案
- 汽车回收工安全演练知识考核试卷含答案
- 小型家用电器制造工创新应用模拟考核试卷含答案
- 2026年秋季开学初中法治意识开学第一课
- 2026年新安全教育培训试题及答案
- 2026 年秋季开学初中军训闭训总结教育课件
- 新版2026小学数学新冀教版五年级上册全册教案(2026秋)合集
- 六年级道德与法治下学期期末模拟卷02(统编版)考试版A4
- 浙江省义金华市乌市2025-2026学年七年级下学期期末考试评价数学卷(含答案)
- 2026年四川省内江市辅警考试真题及答案
- GB/T 47767-2026微机电系统(MEMS)技术压电微悬臂梁机电转换特性的测试方法
- 2026年一建通信实务考前押题试卷及答案
- 施工质量月课件
- 典型心房扑动
评论
0/150
提交评论