Foundations of Database Systems Introduction to DBMS Instructor: Zhijun Wang
Storing Data <ul><li>Using files </li></ul><ul><li>Drawbacks of using file systems to store data: </li></ul><ul><ul><li>Da...
Drawbacks of File Systems - cont <ul><li>Atomicity of updates </li></ul><ul><ul><ul><li>Failures may leave database in an ...
Database Management System <ul><li>Collection of interrelated data </li></ul><ul><li>Set of programs to access the data  <...
The Hierarchy of Data   File-Processing DBMS
Database Management System <ul><li>Database Applications: </li></ul><ul><ul><li>Banking: all transactions </li></ul></ul><...
Art or Engineering <ul><li>Database design and development involves both art and engineering </li></ul><ul><ul><li>Gatheri...
Database Example 1 <ul><li>Mary Richards Housepainting </li></ul><ul><ul><li>Self Employed Entrepreneur </li></ul></ul><ul...
Mary Richards’ Tables SOURCE  CUSTOMER JOB
Database Example 2 <ul><li>Treble Clef Music </li></ul><ul><ul><li>Multi-User database on LAN </li></ul></ul><ul><ul><li>3...
Treble Clef Form 1
Treble Clef Form 2
Treble Clef Form 3
Database Example 3 <ul><li>State Licensing & Vehicle Registration Bureau </li></ul><ul><ul><li>52 Centers, 37 Offices, Hun...
Database Example 4 <ul><li>Calvert Island Reservations Centre </li></ul><ul><ul><li>Chamber of Commerce  </li></ul></ul><u...
Comparison Among Examples
Data Models <ul><li>A collection of tools for describing  </li></ul><ul><ul><li>data  </li></ul></ul><ul><ul><li>data rela...
Entity-Relationship Model <ul><li>Example of schema in  </li></ul><ul><li>the entity-relationship model </li></ul>
Entity Relationship Model <ul><li>E-R model of real world </li></ul><ul><ul><li>Entities (objects)  </li></ul></ul><ul><ul...
Defining Tables using Microsoft Access
Defining Relationships Among the Tables using Microsoft Access
Instances and Schemas <ul><li>Schema  – the logical structure of the database  </li></ul><ul><ul><li>e.g., the database co...
Levels of Abstraction <ul><li>Many  views   and   External Schemas , single  conceptual (logical) schema   and  physical s...
Example: University Database <ul><li>Conceptual level:  </li></ul><ul><ul><li>Students (sid: string, name: string, login: ...
Levels of Abstraction <ul><li>Physical level describes how a record (e.g., customer) is stored. </li></ul><ul><li>Logical ...
Data Independence <ul><li>Applications insulated from how data is structured and stored. </li></ul><ul><li>Logical data in...
Data Definition Language (DDL) <ul><li>Specification notation for defining the database schema </li></ul><ul><ul><li>E.g. ...
Data Definition Language (DDL) <ul><li>Data dictionary contains metadata (i.e., data about data) </li></ul><ul><ul><li>dat...
Data Manipulation Language <ul><li>DML </li></ul><ul><li>Language for accessing and manipulating the data organized by the...
Database System Components
Database Contents   <ul><li>User Data </li></ul><ul><li>Metadata </li></ul><ul><li>Indexes </li></ul><ul><li>Application M...
User Data <ul><li>A table of data is called a  relation </li></ul><ul><li>Columns are fields or  attributes </li></ul><ul>...
Metadata <ul><li>Metadata describes the structure and format of the data and the overall database </li></ul><ul><li>System...
Indexes <ul><li>Improve performance </li></ul><ul><li>Improve accessibility </li></ul><ul><li>(Overhead data) </li></ul>
Application Metadata <ul><li>Stores the structure and format of </li></ul><ul><ul><li>forms </li></ul></ul><ul><ul><li>rep...
The DBMS Engine <ul><li>Design Tools Subsystem </li></ul><ul><li>Run-Time Subsystem </li></ul><ul><li>DBMS Engine </li></ul>
Design Tools Subsystem <ul><li>Tools to design and develop </li></ul><ul><ul><li>tables </li></ul></ul><ul><ul><li>forms <...
A Report in Microsoft Access
Database Users <ul><li>Users are differentiated by the way they expect to interact with the system </li></ul><ul><li>Appli...
Transaction Management <ul><li>A  transaction  is a collection of operations that performs a single logical function in a ...
Storage Management <ul><li>Storage manager is a program module that provides the interface between the low-level data stor...
Database Administrator <ul><li>Database administrator's duties include: </li></ul><ul><ul><li>Schema definition </li></ul>...
Summary <ul><li>DBMS used to maintain, query large data sets. </li></ul><ul><li>Benefits include recovery from system cras...
Upcoming SlideShare
Loading in …5
×

Lesson_1

2,458 views
2,390 views

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,458
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
117
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Lesson_1

  1. 1. Foundations of Database Systems Introduction to DBMS Instructor: Zhijun Wang
  2. 2. Storing Data <ul><li>Using files </li></ul><ul><li>Drawbacks of using file systems to store data: </li></ul><ul><ul><li>Data redundancy and inconsistency </li></ul></ul><ul><ul><ul><li>Multiple file formats, duplication of information in different files </li></ul></ul></ul><ul><ul><li>Difficulty in accessing data </li></ul></ul><ul><ul><ul><li>Need to write a new program to carry out each new task </li></ul></ul></ul><ul><ul><li>Data isolation — multiple files and formats </li></ul></ul><ul><ul><li>Integrity problems </li></ul></ul><ul><ul><ul><li>Integrity constraints (e.g. account balance > 0) become part of program code </li></ul></ul></ul><ul><ul><ul><li>Hard to add new constraints or change existing ones </li></ul></ul></ul>
  3. 3. Drawbacks of File Systems - cont <ul><li>Atomicity of updates </li></ul><ul><ul><ul><li>Failures may leave database in an inconsistent state with partial updates carried out </li></ul></ul></ul><ul><ul><ul><li>E.g. transfer of funds from one account to another should either complete or not happen at all </li></ul></ul></ul><ul><ul><li>Concurrent access by multiple users </li></ul></ul><ul><ul><ul><li>Concurrent accessed needed for performance </li></ul></ul></ul><ul><ul><ul><li>Uncontrolled concurrent accesses can lead to inconsistencies </li></ul></ul></ul><ul><ul><ul><ul><li>E.g. two people reading a balance and updating it at the same time </li></ul></ul></ul></ul><ul><ul><li>Security problems </li></ul></ul><ul><li>Database systems offer solutions to all the above problems </li></ul>
  4. 4. Database Management System <ul><li>Collection of interrelated data </li></ul><ul><li>Set of programs to access the data </li></ul><ul><li>DBMS contains information about a particular enterprise </li></ul><ul><li>DBMS provides an environment that is both convenient and efficient to use. </li></ul>
  5. 5. The Hierarchy of Data File-Processing DBMS
  6. 6. Database Management System <ul><li>Database Applications: </li></ul><ul><ul><li>Banking: all transactions </li></ul></ul><ul><ul><li>Airlines: reservations, schedules </li></ul></ul><ul><ul><li>Universities: registration, grades </li></ul></ul><ul><ul><li>Sales: customers, products, purchases </li></ul></ul><ul><ul><li>Manufacturing: production, inventory, orders, supply chain </li></ul></ul><ul><ul><li>Human resources: employee records, salaries, tax deductions </li></ul></ul><ul><li>Databases touch all aspects of our lives </li></ul>
  7. 7. Art or Engineering <ul><li>Database design and development involves both art and engineering </li></ul><ul><ul><li>Gathering and organizing user requirements is an art </li></ul></ul><ul><ul><li>Transforming the resulting designs into physical applications involves engineering </li></ul></ul>
  8. 8. Database Example 1 <ul><li>Mary Richards Housepainting </li></ul><ul><ul><li>Self Employed Entrepreneur </li></ul></ul><ul><ul><li>Single User Database </li></ul></ul><ul><ul><li>3 Tables (Customers, Jobs, Source) </li></ul></ul><ul><ul><li>Data Needs: </li></ul></ul><ul><ul><ul><li>Track how customers, jobs, and referrals relate </li></ul></ul></ul><ul><ul><ul><li>Record bid estimates </li></ul></ul></ul><ul><ul><ul><li>Track referral sources </li></ul></ul></ul><ul><ul><ul><li>Produce mailing labels </li></ul></ul></ul>
  9. 9. Mary Richards’ Tables SOURCE CUSTOMER JOB
  10. 10. Database Example 2 <ul><li>Treble Clef Music </li></ul><ul><ul><li>Multi-User database on LAN </li></ul></ul><ul><ul><li>3 Tables (Customers, Instruments, Rentals) </li></ul></ul><ul><ul><li>Data Needs: </li></ul></ul><ul><ul><ul><li>Track instrument rentals </li></ul></ul></ul><ul><ul><ul><li>Handle multi-user issues </li></ul></ul></ul>
  11. 11. Treble Clef Form 1
  12. 12. Treble Clef Form 2
  13. 13. Treble Clef Form 3
  14. 14. Database Example 3 <ul><li>State Licensing & Vehicle Registration Bureau </li></ul><ul><ul><li>52 Centers, 37 Offices, Hundreds of Users </li></ul></ul><ul><ul><li>40 Tables </li></ul></ul><ul><ul><li>Data Needs: </li></ul></ul><ul><ul><ul><li>Track drivers licensing issues </li></ul></ul></ul><ul><ul><ul><ul><li>traffic violations, accidents, arrests, limitations </li></ul></ul></ul></ul><ul><ul><ul><li>Track auto registration issues </li></ul></ul></ul><ul><ul><ul><ul><li>revenue, law enforcement </li></ul></ul></ul></ul><ul><ul><ul><li>Integrate the needs of many departments </li></ul></ul></ul>
  15. 15. Database Example 4 <ul><li>Calvert Island Reservations Centre </li></ul><ul><ul><li>Chamber of Commerce </li></ul></ul><ul><ul><li>Promotional database provides access to data </li></ul></ul><ul><ul><li>Customer and reservation database processes </li></ul></ul><ul><ul><li>Data Needs: </li></ul></ul><ul><ul><ul><li>Store multimedia data (photos, video clips, sound clips) </li></ul></ul></ul><ul><ul><ul><li>Must be Web / browser accessible </li></ul></ul></ul><ul><ul><ul><li>Uses Web technologies including HTTP, DHTML, and XML </li></ul></ul></ul>
  16. 16. Comparison Among Examples
  17. 17. Data Models <ul><li>A collection of tools for describing </li></ul><ul><ul><li>data </li></ul></ul><ul><ul><li>data relationships </li></ul></ul><ul><ul><li>data semantics </li></ul></ul><ul><ul><li>data constraints </li></ul></ul><ul><li>Entity-Relationship model </li></ul><ul><li>Relational model </li></ul><ul><li>Other models: </li></ul><ul><ul><li>object-oriented model </li></ul></ul><ul><ul><li>semi-structured data models </li></ul></ul><ul><ul><li>Older models: network model and hierarchical model </li></ul></ul>
  18. 18. Entity-Relationship Model <ul><li>Example of schema in </li></ul><ul><li>the entity-relationship model </li></ul>
  19. 19. Entity Relationship Model <ul><li>E-R model of real world </li></ul><ul><ul><li>Entities (objects) </li></ul></ul><ul><ul><ul><li>E.g. customers, accounts, bank branch </li></ul></ul></ul><ul><ul><li>Relationships between entities </li></ul></ul><ul><ul><ul><li>E.g. Account A-101 is held by customer Johnson </li></ul></ul></ul><ul><ul><ul><li>Relationship set depositor associates customers with accounts </li></ul></ul></ul><ul><li>Widely used for database design </li></ul><ul><ul><li>Database design in E-R model usually converted to design in the relational model (coming up next) which is used for storage and processing </li></ul></ul>
  20. 20. Defining Tables using Microsoft Access
  21. 21. Defining Relationships Among the Tables using Microsoft Access
  22. 22. Instances and Schemas <ul><li>Schema – the logical structure of the database </li></ul><ul><ul><li>e.g., the database consists of information about a set of customers and accounts and the relationship between them </li></ul></ul><ul><ul><li>Analogous to type information of a variable in a program </li></ul></ul><ul><ul><li>Physical schema : database design at the physical level </li></ul></ul><ul><ul><li>Logical schema : database design at the logical level </li></ul></ul><ul><li>Instance – the actual content of the database at a particular point in time </li></ul><ul><ul><li>Analogous to the value of a variable </li></ul></ul>
  23. 23. Levels of Abstraction <ul><li>Many views and External Schemas , single conceptual (logical) schema and physical schema . </li></ul><ul><ul><li>Views describe how users see the data. </li></ul></ul><ul><ul><li>An External Schema is made up of a number of views </li></ul></ul><ul><ul><li>Conceptual schema defines logical structure </li></ul></ul><ul><ul><li>Physical schema describes the files and indexes used. </li></ul></ul><ul><li>Schemas are defined using DDL; data is modified/queried using DML . </li></ul>Physical Schema Conceptual Schema View 1 View 2 View 3
  24. 24. Example: University Database <ul><li>Conceptual level: </li></ul><ul><ul><li>Students (sid: string, name: string, login: string, </li></ul></ul><ul><ul><li> age: integer, gpa: real) </li></ul></ul><ul><ul><li>Course (cid: string, cname: string, credits: integer) </li></ul></ul><ul><ul><li>Enrolled (sid: string, cid: string, grade: string) </li></ul></ul><ul><li>Physical level: </li></ul><ul><ul><li>Relations stored as unordered files. </li></ul></ul><ul><ul><li>Index on first column of Students. </li></ul></ul><ul><li>External level (View): </li></ul><ul><ul><li>Course_info (cid: string, enrollment: integer) </li></ul></ul>
  25. 25. Levels of Abstraction <ul><li>Physical level describes how a record (e.g., customer) is stored. </li></ul><ul><li>Logical level: describes data stored in database, and the relationships among the data. </li></ul><ul><li>type customer = record name : string; street : string; city : integer; end; </li></ul><ul><li>View level: application programs hide details of data types. Views can also hide information (e.g., salary) for security purposes. </li></ul>
  26. 26. Data Independence <ul><li>Applications insulated from how data is structured and stored. </li></ul><ul><li>Logical data independence : Protection from changes in logical structure of data. </li></ul><ul><ul><li>conceptual schema changes, the view does not </li></ul></ul><ul><li>Physical data independence : Protection from changes in physical structure of data. </li></ul><ul><ul><li>File structure/indexes change, conceptual schema does not </li></ul></ul><ul><li>One of the most important benefits of using a DBMS! </li></ul>
  27. 27. Data Definition Language (DDL) <ul><li>Specification notation for defining the database schema </li></ul><ul><ul><li>E.g. create table account ( account-number char(10), balance integer) </li></ul></ul><ul><li>DDL compiler generates a set of tables stored in a data dictionary </li></ul>
  28. 28. Data Definition Language (DDL) <ul><li>Data dictionary contains metadata (i.e., data about data) </li></ul><ul><ul><li>database schema </li></ul></ul><ul><ul><li>Data storage and definition language </li></ul></ul><ul><ul><ul><li>language in which the storage structure and access methods used by the database system are specified </li></ul></ul></ul><ul><ul><ul><li>Usually an extension of the data definition language </li></ul></ul></ul>
  29. 29. Data Manipulation Language <ul><li>DML </li></ul><ul><li>Language for accessing and manipulating the data organized by the appropriate data model </li></ul><ul><ul><li>DML also known as query language </li></ul></ul><ul><li>Two classes of languages </li></ul><ul><ul><li>Procedural – user specifies what data is required and how to get those data </li></ul></ul><ul><ul><li>Nonprocedural – user specifies what data is required without specifying how to get those data </li></ul></ul><ul><li>SQL is the most widely used non-procedural query language </li></ul>
  30. 30. Database System Components
  31. 31. Database Contents <ul><li>User Data </li></ul><ul><li>Metadata </li></ul><ul><li>Indexes </li></ul><ul><li>Application Metadata </li></ul>
  32. 32. User Data <ul><li>A table of data is called a relation </li></ul><ul><li>Columns are fields or attributes </li></ul><ul><li>Rows are entities </li></ul><ul><li>Relations must be structured properly </li></ul>
  33. 33. Metadata <ul><li>Metadata describes the structure and format of the data and the overall database </li></ul><ul><li>System tables store metadata </li></ul><ul><ul><li>number of tables and table names </li></ul></ul><ul><ul><li>number of fields and field names </li></ul></ul><ul><ul><li>primary key fields </li></ul></ul><ul><ul><li>field names, data types, and length </li></ul></ul>
  34. 34. Indexes <ul><li>Improve performance </li></ul><ul><li>Improve accessibility </li></ul><ul><li>(Overhead data) </li></ul>
  35. 35. Application Metadata <ul><li>Stores the structure and format of </li></ul><ul><ul><li>forms </li></ul></ul><ul><ul><li>reports </li></ul></ul><ul><ul><li>queries </li></ul></ul><ul><ul><li>other application components </li></ul></ul>
  36. 36. The DBMS Engine <ul><li>Design Tools Subsystem </li></ul><ul><li>Run-Time Subsystem </li></ul><ul><li>DBMS Engine </li></ul>
  37. 37. Design Tools Subsystem <ul><li>Tools to design and develop </li></ul><ul><ul><li>tables </li></ul></ul><ul><ul><li>forms </li></ul></ul><ul><ul><li>queries </li></ul></ul><ul><ul><li>reports </li></ul></ul><ul><li>Programming Languages </li></ul><ul><ul><li>macros </li></ul></ul><ul><ul><li>languages </li></ul></ul>
  38. 38. A Report in Microsoft Access
  39. 39. Database Users <ul><li>Users are differentiated by the way they expect to interact with the system </li></ul><ul><li>Application programmers – interact with system through DML calls </li></ul><ul><li>Sophisticated users – form requests in a database query language </li></ul><ul><li>Specialized users – write specialized database applications that do not fit into the traditional data processing framework </li></ul><ul><li>Naïve users – invoke one of the permanent application programs that have been written previously </li></ul><ul><ul><li>E.g. people accessing database over the web, bank tellers, clerical staff </li></ul></ul>
  40. 40. Transaction Management <ul><li>A transaction is a collection of operations that performs a single logical function in a database application </li></ul><ul><li>Transaction-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. </li></ul><ul><li>Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database. </li></ul>
  41. 41. Storage Management <ul><li>Storage manager is a program module that provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system. </li></ul><ul><li>The storage manager is responsible to the following tasks: </li></ul><ul><ul><li>interaction with the file manager </li></ul></ul><ul><ul><li>efficient storing, retrieving and updating of data </li></ul></ul>
  42. 42. Database Administrator <ul><li>Database administrator's duties include: </li></ul><ul><ul><li>Schema definition </li></ul></ul><ul><ul><li>Storage structure and access method definition </li></ul></ul><ul><ul><li>Schema and physical organization modification </li></ul></ul><ul><ul><li>Granting user authority to access the database </li></ul></ul><ul><ul><li>Specifying integrity constraints </li></ul></ul><ul><ul><li>Acting as liaison with users </li></ul></ul><ul><ul><li>Monitoring performance and responding to changes in requirements </li></ul></ul>
  43. 43. Summary <ul><li>DBMS used to maintain, query large data sets. </li></ul><ul><li>Benefits include recovery from system crashes, concurrent access, quick application development, data integrity and security. </li></ul><ul><li>Levels of abstraction give data independence. </li></ul><ul><li>A DBMS typically has a layered architecture. </li></ul><ul><li>DBAs hold responsible jobs and are well-paid ! </li></ul><ul><li>DBMS R&D is one of the broadest, most exciting areas in CS. </li></ul>

×