Full Transcript

Chapter 2 Database System Concepts and Architecture Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture Copyright © 2011 Pearson Education, Inc....

Chapter 2 Database System Concepts and Architecture Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Outline Data Models and Their Categories Schemas, Instances, and States Three-Schema Architecture and Data Independence DBMS Languages and Interfaces Database System Architectures Classification of DBMSs Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Data Models Data Model: – A set of concepts to describe the structure of a database, the operations for manipulating the data, and the constraints that the data should follow. Data Model Structure and Constraints: – Data Model constructs define the database structure – Data model constructs often include: data elements and their data types (often called attributes); grouping of related elements into entities (also called objects or records or tuples); and relationships among entities – Constraints specify restrictions on the stored data; the data that satisfies the constraints is called valid data Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Data Model: Example 1. Data Model Structure Entities: Students Courses Instructors Enrollments Grades Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Data Model: Example Students and Enrollments (One-to-Many) Relationship: One student can be enrolled in multiple courses, but each enrollment record is tied to one specific student. Courses and Enrollments (One-to-Many) Relationship: One course can have multiple students enrolled, but each enrollment record is tied to one specific course. Students and Grades (One-to-Many) Relationship: One student can have multiple grades (one for each course), but each grade record is tied to one specific student. Courses and Instructors (Many-to-One) Relationship: Many courses can be taught by one instructor, but each course is taught by only one instructor. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Data Model: Example Student Operations Register Student: Insert a new student record into the Students table. Update Student Info: Modify student details (e.g., address, email, phone). View Student Profile: Retrieve details of a student by student_id. Delete Student: Remove a student from the system. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Data Model: Example Primary Key Constraints: Each table has a primary key (student_id) to uniquely identify each record. Unique Constraint: Ensure that Students.email is unique to avoid duplicates. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Categories of Data Models Conceptual (high-level, semantic) data models: – Provide concepts that are close to the way many users perceive data. (Also called entity-based or object-based data models.) Implementation (representational) data models: – Provide concepts used by many commercial DBMS implementations (e.g. relational data models used in many commercial systems). Physical (low-level, internal) data models: – Provide concepts that describe details of how data is stored in the computer. These are usually specified in an ad-hoc manner through DBMS design and administration manuals Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Categories of Data Models Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Database Schema versus Database State Database Schema: – The description of a database. – Includes descriptions of the database structure, relationships, data types, and constraints Schema Diagram: – An illustrative display of (some aspects of) a database schema Schema Construct: – A component of the schema or an object within the schema, e.g., STUDENT, COURSE, Name Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Example of a Database Schema Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Database Schema vs. Database State (cont.) Database State: – The actual data stored in a database at a particular moment in time. This includes the collection of all the data in the database. – Also called a database instance (or occurrence or snapshot). NOTE: The term instance is also used to refer to individual database components, e.g. a record instance, table instance, or entity instance Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Database Schema vs. Database State Database State: – Refers to the content of a database at a particular moment in time. Initial Database State: – Refers to the database state when it is initially loaded into the system. Valid State: – A state that satisfies the structure and constraints of the database. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Database Schema vs. Database State (cont.) Distinction – The database schema changes very infrequently. – The database state changes every time the database is updated. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Three-Schema Architecture (cont.) Defines DBMS schemas at three levels: – Internal schema at the internal level to describe physical storage structures and access paths (e.g indexes). Typically uses a physical data model. – Conceptual schema at the conceptual level to describe the structure and constraints for the whole database for a community of users. Uses an implementation (or a conceptual) data model. – External schemas at the external level to describe the various user views. Usually uses the same data model as the conceptual schema. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The three-schema architecture (cont.) Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Three-Schema Architecture (cont.) Mappings among schema levels are needed to transform requests and data. – Users and programs refer to an external schema, and are mapped by the DBMS to the internal schema for execution. – Data extracted from the internal DBMS level is reformatted to match the user’s external view (e.g. formatting the results of an SQL query for display as a Web page) Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley DBMS Interfaces Stand-alone query language interfaces – Example: Typing SQL queries directly through the DBMS interactive SQL interface (e.g. SQL*Plus in ORACLE) Programmer interfaces for embedding DML in programming languages User-friendly interfaces (often Web-based) – Menu-based, forms-based, graphics-based, etc. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley DBMS Interfaces Stand-alone query language interfaces – Example: Typing SQL queries directly through the DBMS interactive SQL interface (e.g. SQL*Plus in ORACLE) Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley DBMS Programming Language Interfaces Programmer interfaces for embedding DML in a programming language (see Chapter 13): – Embedded Approach: e.g embedded SQL (for C, C++, etc.), SQLJ (for Java) – Procedure Call Approach: e.g. JDBC for Java, ODBC for other programming languages – Database Programming Language Approach: e.g. ORACLE has PL/SQL, a programming language based on SQL; language incorporates SQL and its data types as integral components Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley DBMS Programming Language Interfaces Embedded Approach: e.g embedded SQL (for C, C++, etc.), SQLJ (for Java) Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley DBMS Programming Language Interfaces Procedure Call Approach: e.g. JDBC for Java, ODBC for other programming languages. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley DBMS Programming Language Interfaces Database Programming Language Approach: e.g. ORACLE has PL/SQL, a programming language based on SQL; language incorporates SQL and its data types as integral components Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley User-Friendly and Web-based DBMS Interfaces – Menu-based, popular for browsing on the web – Forms-based, designed for naïve users – Graphics-based (Point and Click, Drag and Drop, etc.) – Natural language: requests in written English – Combinations of the above: For example, both menus and forms used extensively in Web database interfaces Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Other DBMS Interfaces – Speech as Input and Output – Web Browser as an interface – Parametric interfaces, e.g., bank tellers using function keys. – Interfaces for the DBA: Creating user accounts, granting authorizations Setting system parameters Changing schemas or storage structures/access paths (physical database) Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Other Tools (cont.) Application Development Environments and CASE (computer-aided software engineering) tools often have a database design component Examples: – PowerBuilder (Sybase) – JBuilder (Borland) – JDeveloper 10G (Oracle) Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley DBMS Architectures (cont.) Basic 2-tier Client-Server Architecture: Specialized Server nodes with Specialized functions – Print server – File server – DBMS server – Web server – Email server Client nodes can access the specialized servers as needed Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Logical two-tier client server architecture Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Two Tier Client-Server DBMS Architecture A program running at a client may connect to several DBMSs (also called data sources). In general, data sources can be files or other non- DBMS software that manages data. Client focuses on user interface interactions and only accesses database when needed. In some cases (e.g. some object DBMSs), more functionality is transferred to clients (e.g. data dictionary functions, optimization and recovery across multiple servers, etc.) Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Three Tier Client-Server DBMS Architecture Common for Web applications Third intermediate layer (middle tier) called Application Server or Web Server: – Stores the web connectivity software and the business logic part of the application – Accesses and updates data on the database server – Acts like a conduit for sending partially processed data between the database server and the client. Three-tier Architecture Can Enhance Security: – Database server only accessible via middle tier – Clients cannot directly access database server Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Three-tier client-server architecture Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Client nodes Provide appropriate interfaces through a client software module to access and utilize the various server resources. Clients may be PCs or Workstations (or even diskless machines) with the client software installed. Connected to the servers via a network. – LAN: local area network – wireless network – etc. Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley DBMS Server Provides database query and transaction services to the clients Relational DBMS servers are often called SQL servers, query servers, or transaction servers Applications running on clients utilize an Application Program Interface (API) to access server databases via standard interface such as: – ODBC: Open Database Connectivity standard – JDBC: for Java programming access Client and server must install appropriate client module and server module software for ODBC or JDBC See Chapter 13 Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Use Quizgecko on...
Browser
Browser