2. Database System Concepts and Architecture Chapter 2 2.1 Data Models, Schemas, and Instances Data Model: A collection of concepts used to describe the structure of a database Database Structure: Data types, relationships, and constraints on data Database Schema: The description of the database (intension) Schema Diagram: Diagrammatic representation of the DB schema Schema Construct: An object in the schema Database State/Instance: The data in the database at a particular moment in time (extension) 2.1 Data Models, Schemas, and Instances Database schema Database Instance 2.1 Data Models, Schemas, and Instances Schema diagram displays some aspects of the schema Define a new DB? Specify the DB schema DB state is the empty state Populate DB with initial data? Data types and relationships are not evident No changes in the schema DB state is the initial state Subsequent update operations? No changes in the schema DB state changes into a new state 2.1 Data Models, Schemas, and Instances DBMS ensures that every DB state is a valid state Special care must be taken when designing a DB schema A state that satisfies the structure and constraints specified in the schema A schema is not supposed to change frequently A DBMS stores the meta-data Schema constructs and constraints 2.2 DBMS Architecture and Data Independence DB architecture is specified using a three-schema architecture Used to achieve the first 3 characteristics of DB approach 1. 2. 3. Separation between programs and data Support of multiple user views Use of catalog to store DB schema Provides only a description of data 2.2.1 The Three-Schema Architecture 1. Physical (Internal) Level 2. Logical (Conceptual) Level 3. Has an internal schema Describes the physical storage structure of the DB Has a conceptual schema Describes the structure of the whole DB (entities, data types, relationships, user operations, and constraints) Hides details of the physical level External (View) Level Has several external schemas or user views Each describes the part of the DB that a particular user is interested in 2.2.1 The Three-Schema Architecture External View … mapping External View mapping Conceptual Schema mapping Internal Schema 2.2.2 Data Independence Data Independence Ability to change the schema at one level of a DB system without having to change the schema at the next higher level Result? 1. 2. Logical data independence Physical data independence 2.2.2 Data Independence 1. Logical data independence Ability to change the conceptual schema without having to change the external schemas or application programs Changes? Expand the DB (add a record or data item) Reduce the DB (remove a record or data item) Changes to constraints 2.2.2 Data Independence 2. Physical data independence Ability to change the internal schema without having to change the conceptual or external schemas Changes? Reorganization of physical files 2.3.1 DBMS Languages Data Definition Language (DDL) Used by the DBA and database designers to specify the conceptual schema of a database In many DBMSs, the DDL is also used to define internal and external schemas (views) In some DBMSs, separate storage definition language (SDL)andview definition language (VDL) are used to define internal and external schemas SDL is typically realized via DBMS commands provided to the DBA and database designers 2.3.1 DBMS Languages Data Manipulation Language (DML) Used to specify database retrievals and updates DML commands (data sublanguage) can be embedded in a general-purpose programming language (host language), such as COBOL, C, C++, or Java. A library of functions can also be provided to access the DBMS from a programming language Alternatively, stand-alone DML commands can be applied directly (called a query language). 2.3.1 DBMS Languages Data Manipulation Language (DML) DML Types: High Level or Non-procedural Language For example, the SQL relational language Are “set”-oriented and specify what data to retrieve rather than how to retrieve it. Also called declarative languages. Low Level or Procedural Language Retrieve data one record-at-a-time; Constructs such as looping are needed to retrieve multiple records, along with positioning pointers 2.3.2 DBMS Interfaces Menu-Based Interfaces Forms-Based Interfaces Speech used as input query and/or as query result Interfaces for Parametric Users Requests are written in English Speech Input and Output Point and Click, Drag and Drop, etc. Natural Language Interfaces Designed for naïve users Graphical User Interfaces (GUI) Popular for browsing the Web Ex: bank tellers using function keys Interfaces for the DBA Commands used for Creating user accounts, granting authorizations, setting system parameters, changing schemas or access paths 2.4 The Database System Environment 2.5 DBMS Architectures 1. Centralized DBMSs Architecture Combines everything into single system including- DBMS software, hardware, application programs, and user interface processing software User can still connect through a remote terminal – however, all processing is done at centralized site 2.5 DBMS Architectures 2. Basic Client/Server Architectures Specialized Servers with Specialized functions (Print server, File server, DBMS server, Web server, Email server) Clients can access the specialized servers as needed 2.5 DBMS Architectures 3. Two-Tier Client/Server Architectures A client program may connect to several DBMSs, sometimes called the data sources Data sources can be files or other non-DBMS software that manages data Other variations of clients are possible 2.5 DBMS Architectures 4. Three-Tier and n-tier Architectures Common for Web applications Intermediate Layer called Application Server or Web Server: Such an architecture can enhance security: Database server only accessible via middle tier Clients cannot directly access database server 2.6 Classification of Database Management Systems Several criteria are used Data Model Traditional 1. 2. 3. Emerging 4. 5. Relational data model Network data model Hierarchical data model Object data model Object-relational data model Number of Users 1. 2. Single-user systems Multi-user systems 2.6 Classification of Database Management Systems Number of Sites 1. 2. Centralized DBMS Distributed DBMS Homogeneous DDBMS Heterogeneous DDBMS Federated DBMS (multidatabase system) Any Questions?