Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Chapter 1: Introduction <ul><li>Databases & Database Management Systems (DBMS) </li></ul><ul><li>Levels of Abstraction </li></ul><ul><li>Data Models </li></ul><ul><li>Database Languages </li></ul><ul><li>Types of Users </li></ul><ul><li>DBMS Function and Structure </li></ul><ul><li>Read Chapter 1, including the historical notes on pages 28 and 29. </li></ul>
  2. 2. What is a Database? <ul><li>According to the book: </li></ul><ul><ul><li>Collection of interrelated data </li></ul></ul><ul><ul><li>Set of programs to access the data </li></ul></ul><ul><ul><li>A DBMS contains information about a particular enterprise </li></ul></ul><ul><ul><li>DBMS provides an environment that is both convenient and efficient to use. </li></ul></ul><ul><li>Another definition: </li></ul><ul><ul><li>A database is a collection of organized, interrelated data, typically relating to a particular enterprise </li></ul></ul><ul><ul><li>A Database Management System (DBMS) is a set of programs for managing and accessing databases </li></ul></ul>
  3. 3. Some Popular Database Management Systems <ul><li>Commercial “off-the-shelf” (COTS): </li></ul><ul><ul><li>Oracle </li></ul></ul><ul><ul><li>IBM DB2 (IBM) </li></ul></ul><ul><ul><li>SQL Server (Microsoft) </li></ul></ul><ul><ul><li>Sybase </li></ul></ul><ul><ul><li>Informix (IBM) </li></ul></ul><ul><ul><li>Access (Microsoft) </li></ul></ul><ul><ul><li>Cache (Intersystems – nonrelational) </li></ul></ul><ul><li>Open Source: </li></ul><ul><ul><li>MySQL </li></ul></ul><ul><ul><li>PostgreSQL </li></ul></ul><ul><ul><li>Note: This is not a course on any particular DBMS! </li></ul></ul>
  4. 4. Some Database Applications <ul><li>Databases touch all aspects of our lives: </li></ul><ul><ul><li>Banking – accounts, loans, customers </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>Anywhere there is data, there could be a database. </li></ul><ul><li>Course context is an “enterprise” that has requirements for: </li></ul><ul><ul><li>Storage and management of 100’s of gigabytes or terabytes of data </li></ul></ul><ul><ul><li>Support for 100’s or more of concurrent users and transactions </li></ul></ul><ul><ul><li>Traditional supporting platform, e.g, Sun Enterprise server, 4GB RAM, 50TB of disk space </li></ul></ul>
  5. 5. Purpose of Database System <ul><li>Prior to the availability of COTS DBMSs, database applications were built on top of file systems – coded from the ground up. </li></ul><ul><ul><li>Sometimes this approach is still advocated. </li></ul></ul><ul><li>Drawbacks of this approach: </li></ul><ul><ul><li>Data redundancy and inconsistency </li></ul></ul><ul><ul><li>Multiple files and formats </li></ul></ul><ul><ul><li>A new program is required to carry out each new task </li></ul></ul><ul><ul><li>Integrity constraints (e.g. account balance > 0) become embedded throughout program code </li></ul></ul><ul><ul><li>Plus others… </li></ul></ul>
  6. 6. Purpose of Database Systems (Cont.) <ul><li>Database systems offer solutions for the above problems. </li></ul><ul><li>Database systems also support: </li></ul><ul><ul><li>Atomicity of updates </li></ul></ul><ul><ul><li>Concurrent access by multiple users </li></ul></ul><ul><ul><li>Data security, etc. </li></ul></ul><ul><li>Recoding this functionality from scratch is not easy! </li></ul><ul><li>So when should we code from scratch, and when do we buy a DBMS?? </li></ul>
  7. 7. Levels of Abstraction <ul><li>Physical level : defines low-level details about how data item is stored on disk. </li></ul><ul><li>Logical level : describes data stored in a database, and the relationships among the data. </li></ul><ul><ul><li>Usually conveyed as a data model, e.g., an ER diagram. </li></ul></ul><ul><li>View level : defines how information is presented to users. Views can also hide details of data types, and information (e.g., salary) for security purposes. </li></ul>
  8. 8. View of Data, Cont. <ul><li>Physical data independence is the ability to modify the physical schema without changing the logical or view levels. </li></ul><ul><li>Physical data independence is important in any database or DBMS. </li></ul>
  9. 9. Instances vs. Schemas <ul><li>The difference between a database schema and a database instance is similar to the difference between a data type and a variable in a program. </li></ul><ul><li>A database schema defines the structure or design of a database </li></ul><ul><ul><li>Analogous to type information of a variable in a program </li></ul></ul><ul><ul><li>For example, a database might consists of information about a set of customers and accounts and the relationship between them </li></ul></ul><ul><li>More precisely: </li></ul><ul><ul><li>A logical schema defines a database design at the logical level </li></ul></ul><ul><ul><li>A physical schema defines a database design at the physical level </li></ul></ul><ul><li>An instance of a database is the combination of the database and its’ contents at one point in time </li></ul><ul><ul><li>Analogous to a variable and its’ value </li></ul></ul>
  10. 10. What is a Data Model? <ul><li>The phrase “data model” is used in a couple of different ways. </li></ul><ul><li>Frequently used (use #1) to refer to an overall approach or philosophy for database design and development. </li></ul><ul><li>For those individuals, groups and corporations that subscribe to a specific data model, that model permeates all aspects of database design, development, implementation, etc. </li></ul><ul><li>Current data models: </li></ul><ul><ul><li>Relational model </li></ul></ul><ul><ul><li>Entity-Relationship model </li></ul></ul><ul><ul><li>Object-oriented model, Object-relational model </li></ul></ul><ul><ul><li>Semi, and non-structured data models </li></ul></ul><ul><li>Legacy models: </li></ul><ul><ul><li>Network </li></ul></ul><ul><ul><li>Hierarchical </li></ul></ul>
  11. 11. What is a Data Model, Cont? <ul><li>During the early phases of database design and development, a “data model” is frequently developed (use #2). </li></ul><ul><li>The purpose of developing the data model is to define: </li></ul><ul><ul><li>Data </li></ul></ul><ul><ul><li>Relationships between data items </li></ul></ul><ul><ul><li>Semantics of data items </li></ul></ul><ul><ul><li>Constraints on data items </li></ul></ul><ul><ul><li>In other words, a data model defines the logical schema, i.e., the logical level of design of a database. </li></ul></ul><ul><li>A data model is typically conveyed as one or more diagrams. </li></ul><ul><li>The type of diagrams used depends on the overall approach or philosophy (i.e., the data model, as defined in the first sense). </li></ul><ul><li>This early phase in database development is referred to as data modeling . </li></ul>
  12. 12. Entity-Relationship Model <ul><li>Example of an entity-relationship diagram: </li></ul><ul><li>Widely used for database modeling. </li></ul><ul><li>An ER model is converted to tables in a relational database. </li></ul>
  13. 13. Relational Model <ul><li>Example of tabular data in the relational model: </li></ul><ul><li>From a data modeling perspective, which approach is preferable? The ER model, or the relational model? </li></ul>Attributes customer-name customer-id customer-street customer-city account-number Johnson Smith Johnson Jones Smith 192-83-7465 019-28-3746 192-83-7465 321-12-3123 019-28-3746 Alma North Alma Main North Palo Alto Rye Palo Alto Harrison Rye A-101 A-215 A-201 A-217 A-201
  14. 14. A Sample Relational Database <ul><li>Regardless of the model, the end result is the same: </li></ul>
  15. 15. Data Definition Language (DDL) <ul><li>DDL is used for defining a (physical) database schema (see page 129 for a more complete example): </li></ul><ul><li>create table account ( account-number char (10), balance integer ) </li></ul><ul><li>Given a DDL file, the DDL compiler generates a set of tables. </li></ul><ul><li>A description of those tables is stored in a data dictionary : </li></ul><ul><ul><li>Contains information from the database schema </li></ul></ul><ul><ul><li>Frequently referred to as metadata (i.e., data about data) </li></ul></ul><ul><li>Data storage and definition language (DSDL?): </li></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><li>Usually an extension of the data definition language </li></ul></ul>
  16. 16. Data Manipulation Language (DML) <ul><li>DML is used for accessing and manipulating a database </li></ul><ul><ul><li>DML is also known as a query language </li></ul></ul><ul><li>Two classes of DML: </li></ul><ul><ul><li>Procedural – user specifies how to get the required data </li></ul></ul><ul><ul><li>Non-procedural – user specifies what data is required without specifying how to get that data </li></ul></ul><ul><li>SQL is the most widely used DML (query language): </li></ul><ul><ul><li>Usually referred to as a non-procedural query language </li></ul></ul>
  17. 17. SQL Examples <ul><li>Find the name of the customer with customer-id 192-83-7465: </li></ul><ul><li>select customer.customer-name from customer where customer.customer-id = ‘192-83-7465’ </li></ul><ul><li>Find the balances of all accounts held by the customer with customer-id 192-83-7465: </li></ul><ul><li>select account.balance from depositor , account where depositor.customer-id = ‘192-83-7465’ and depositor.account-number = account.account-number </li></ul><ul><li>Databases are typically accessed by: </li></ul><ul><ul><li>Users through a command line interface </li></ul></ul><ul><ul><li>Users through a query or software editing tool </li></ul></ul><ul><ul><li>Application programs that (generally) access them through embedded SQL or an application program interface (e.g. ODBC/JDBC) </li></ul></ul>
  18. 18. Database Users <ul><li>Users are differentiated by the way they interact with the system </li></ul><ul><li>Naïve users invoke application programs that have been written previously, e.g. people accessing a database over the web, bank tellers, clerical staff, ATM users </li></ul><ul><li>Application programmers interact with the system by making DML calls through an API, e.g., ODBC or JDBC from within a computer program </li></ul><ul><li>Sophisticated users form requests in a database query language, typically submitted at the command-line, e.g., a database administrator </li></ul><ul><li>Specialized users write specialized database applications that do not fit into the traditional data processing framework, e.g., geo-spatial or CAD specialists </li></ul>
  19. 19. Database Administrator (DBA) <ul><li>The DBA coordinates all the activities of the database system; has a good understanding of the enterprise’s information resources and needs. </li></ul><ul><li>DBA duties: </li></ul><ul><ul><li>Granting user authority to access the database </li></ul></ul><ul><ul><li>Acting as liaison with users </li></ul></ul><ul><ul><li>Installing and maintaining DBMS software </li></ul></ul><ul><ul><li>Monitoring performance and performance tuning </li></ul></ul><ul><ul><li>Backup and recovery </li></ul></ul><ul><li>According to the book, the DBA is also responsible for: </li></ul><ul><ul><li>Logical and Physical schema definition and modification </li></ul></ul><ul><ul><li>Access method definition </li></ul></ul><ul><ul><li>Specifying integrity constraints </li></ul></ul><ul><ul><li>Responding to changes in requirements </li></ul></ul><ul><li>These latter tasks are typically performed by a software engineer specialized in database design, or perhaps a systems engineer </li></ul>
  20. 20. 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>The backup and recovery components of a DBMS ensure that the database remains in a consistent (correct) state despite failures: </li></ul><ul><ul><li>system, power, network failures </li></ul></ul><ul><ul><li>operating system crashes </li></ul></ul><ul><ul><li>transaction failures. </li></ul></ul><ul><li>The concurrency-control manager in a DBMS controls the interaction among the concurrent transactions, to ensure the consistency of the database. </li></ul>
  21. 21. Storage Management <ul><li>The storage manager in a DBMS 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><ul><li>Note that the DBMS may or may not make use of the facilities of the operating system’s file management facilities. </li></ul>
  22. 22. Overall System Structure Query Optimizer
  23. 23. Application Architectures <ul><li>Architectures: </li></ul><ul><ul><li>Mainframe – client programs and DBMS reside on one platform. </li></ul></ul><ul><ul><li>Two Tier – client programs and DBMS reside on different platforms; clients connect to DBMS via an API such as ODBC/JDBC. </li></ul></ul><ul><ul><li>Three Tier – client programs, application server (or other “middleware”), and DBMS; clients connect to DBMS indirectly through the application server (also via an API). Typically used in web-based applications. </li></ul></ul><ul><ul><li>N Tier – generalization of 2 and 3 tier architectures. </li></ul></ul>