Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database System Concepts and Architecture Lecture # 2 21 June 2012 National University of Computer and Emerging Sciences.

Similar presentations

Presentation on theme: "Database System Concepts and Architecture Lecture # 2 21 June 2012 National University of Computer and Emerging Sciences."— Presentation transcript:

1 Database System Concepts and Architecture Lecture # 2 21 June 2012 National University of Computer and Emerging Sciences

2 Data Models A set of concepts to describe the structure of a database. – The structure includes data types, relationships and constraints. Data Model Operations – Operations for specifying database retrievals and updates by referring to the concepts of the data model. – Data model may include basic operations and user-defined operations

3 Database Schemas Database Schema – The description of a database using the given data model. – Example: the database consists of information about a set of customers and accounts and the relationship between them – Analogous to type information of a variable in a program Schema Diagram – An illustrative display of a database schema. Schema Construct – A component of the schema or an object within the schema, e.g., STUDENT, COURSE.

4 Data Model and Schema The relational model of data is the most widely used model today – Main concept: relation, basically a table with rows and columns. – Every relation has a schema, which describes the columns, or fields.

5 Example of a Database Schema

6 Database State – Refers to the content of a database at a moment in time. – Also called database instance or occurrence. – Analogous to the value of a variable Initial 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

7 Example of a database state

8 Schemas versus State Schema changes very infrequently, whereas state changes every time the database is updated. Schema is also called intension, whereas state is called extension. Database Schema Database State

9 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. Physical (low-level, internal) data models – Provide concepts that describe details of how data is stored in the computer. Implementation (representational) data models – Provide concepts that fall between the above two, balancing user views with some computer storage details. It includes relational data model.

10 Entity-Relationship Model Example of schema in the entity-relationship model

11 Relational Data Model A Sample Relational Database

12 Three-Schema Architecture Proposed to support DBMS characteristics of: – Insulation of programs and data Program data independence Program operation independence – Support of multiple views of the data. – Use of catalog to store schema

13 Three-Schema Architecture Defines DBMS schemas at three levels: – Internal schema describes physical storage structures and access paths. Typically uses a physical data model. – Conceptual schema describes the structure and constraints for the database for a community of users. Uses a conceptual or an implementation data model. – External schemas describes the various user views. Usually uses the same data model as the conceptual schema.

14 Three-Schema Architecture

15 Mappings among schema levels are needed to transform requests and data. – 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 in a Web page)

16 Data Independence Logical Data Independence – The capacity to change the conceptual schema without having to change the external schemas and their associated application programs. (Only the mappings need to be changed in DBMS) Physical Data Independence – The capacity to change the internal schema without having to change the conceptual schema. – For example, the internal schema may be changed when certain file structures are reorganized or new indexes are created to improve database performance  One of the most important benefits of using a DBMS!

17 DBMS Languages Data Definition Language (DDL) Data Manipulation Language (DML)

18 DBMS Languages Data Definition Language (DDL): – Used by the DBA and database designers to specify the conceptual schema of a database. – Specification (notation) for defining the database schema. E.g. create table account ( account-number char(10), balance integer) – Storage definition language (SDL) is used to specify internal schema. – View definition language (VDL) is used to define views and their mapping to conceptual schema. Slide 2- 18

19 DBMS Languages Data Manipulation Language (DML) – Used to specify database retrievals and updates Two classes of languages – Procedural (Low Level ) user specifies what data is required and how to get those data These must be embedded in a programming language – Nonprocedural (High Level ) user specifies what data is required without specifying how to get those data May be used in a standalone way(query language) or may be embedded in a programming language (host language) Slide 2- 19

20 DBMS Interfaces Stand-alone query language interfaces – Example: Entering SQL queries at the DBMS interactive SQL interface (e.g. SQL*Plus in ORACLE) Programmer interfaces for embedding DML in programming languages User-friendly interfaces such as – Menu-based, forms-based, graphics-based, etc. Slide 2- 20

21 Database System Utilities To perform certain functions such as: – Loading data stored in existing files into a database. Includes data conversion tools. – Backing up the database periodically on tape. – Reorganizing database file structures. – Report generation utilities. – Performance monitoring utilities. – Other functions, such as sorting, user monitoring, data compression, etc. Slide 2- 21

22 Data dictionary / repository – Used to store schema descriptions and other information such as design decisions, application program descriptions, user information, usage standards, etc. – Active data dictionary is accessed by DBMS software and users/DBA. – Passive data dictionary is accessed by users/DBA only. Slide 2- 22

23 Typical DBMS Component Modules Slide 2- 23

24 DBMS Architectures Centralized DBMS – Combines everything into single system including- DBMS software, hardware, application programs, and user interface processing software. – User can connect through a remote terminal. Slide 2- 24

25 Basic 2-tier Client-Server Architectures Client – a user machine with user interface capabilities and local processing. – It can access the specialized servers as needed Server – contains both hardware and software that provide services to clients, such as printing, file access, or database access Slide 2- 25

26 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 Slide 2- 26

27 Two Tier Client-Server Architecture A client program may connect to several DBMSs, sometimes called the data sources. In general, data sources can be files or other non-DBMS software that manages data. Other variations of clients are possible: e.g., in some object DBMSs, more functionality is transferred to clients including data dictionary functions, optimization and recovery across multiple servers, etc. Slide 2- 27

28 Three Tier Client-Server Architecture Adds Intermediate layer called Application Server or Web Server. Middle Tier stores business logic that is use to access data from the database server Enhance security as DB server is only accessible via middle tier Slide 2- 28

29 Classification of DBMSs Based on the data model used – Traditional: Relational, Network, Hierarchical. – Emerging: Object-oriented, Object-relational. Single-user (typically used with personal computers) vs. multi-user (most DBMSs). Centralized (uses a single computer with one database) vs. distributed (uses multiple computers, multiple databases) Slide 2- 29

30 Record-based Logical Models Describe data at the conceptual and view levels. Specify overall logical structure of the database Provide a higher-level description of the implementation. The database is structured in fixed-format records of several types. – Each record defines a fixed number of fields, or attributes. – Each field is usually of a fixed length (this simplifies the implementation). The three most widely-accepted models are – relational, – network, and – hierarchical.

31 Relational Model Data and relationships are represented by a set of tables. A tuple or row contains all the data of a single instance of the table. Each table has a number of columns with unique names Every tuple must have a unique identification or key based on the data.

32 Network Model Data are represented by collections of records. Relationships among data are represented by links. Organization is that of an arbitrary graph.

33 Hierarchical Model Similar to the network model. Organization of the records is as a collection of trees, rather than arbitrary graphs. The relational model does not use pointers or links, but relates records by the values they contain. This allows a formal mathematical foundation to be defined.

34 Object Data Model Defines database in terms of objects, their properties and operations. Objects with same structure and behavior belong to a class Classes are organized into hierarchies The operations of each class are specified as methods Internal parts of the object, the instance variables and method code, are not visible externally. Describe data at the conceptual and view levels. Allow one to specify data constraints explicitly.

35 Example: Object Data Model For example, consider an object representing a bank account. The object contains instance variables number and balance The object contains a method pay-interest which adds interest to the balance. Under most data models, changing the interest rate entails changing code in application programs. In the object-oriented model, this only entails a change within the pay-interest method.

36 Distributed DBMSs (DDBMSs) Distributed Database Systems can have database and DBMS software distributed over many Homogeneous DDBMS Heterogeneous DDBMS Federated or Multidatabase Systems Uses client-server architecture Slide 2- 36

Download ppt "Database System Concepts and Architecture Lecture # 2 21 June 2012 National University of Computer and Emerging Sciences."

Similar presentations

Ads by Google