Presentation is loading. Please wait.

Presentation is loading. Please wait.

Instructors: Churee Techawut Introduction to Database System Chapter 1 CS (204)321 Database System I.

Similar presentations


Presentation on theme: "Instructors: Churee Techawut Introduction to Database System Chapter 1 CS (204)321 Database System I."— Presentation transcript:

1 Instructors: Churee Techawut Introduction to Database System Chapter 1 CS (204)321 Database System I

2 Outlines 1) Basic definitions 2) Database system environment 3) Examples of database 4) Typical DBMS functionality 5) Major characteristics of database approach 6) Different types of database users 7) Additional characteristics of database approach 8) When not to use a DBMS 9) Components of a database system 10) Database system concepts and architecture

3 Database System Concepts and Architecture 1)Data models 2)Schemas VS. instances 3)Three-schema architecture 4)Data Independence 5)DBMS language 6)DBMS Interface 7)Database system environment 8)Database system utilities 9)Database architectures 10)Classification of DBMS

4 Data Models “Operations for specifying database retrievals and updates by referring to the concepts of the data model.” Operations on the data model may include basic operations and user-defined operations. (e.g. A user-defined operation is COMPUTE_GPA which can be applied to a STUDENT object.)  Data model operations  Data model “A set of concepts that can be used to describe the structure of a database (data types and relationships) and certain constraints that the database should obey.”

5 Data Models  Categories of data models 1) Conceptual (high-level, semantic) data models: Provide concepts that are close to the way many users perceive data. 2) Physical (low-level, internal) data models: Provide concepts that describe the details of how data is stored in the computer. 3) Implementation (representational) data models: Provide concepts that fall between above two, balancing user views with some computer storage details.

6 Schemas VS. Instances  In any data model it is important to distinguish between the description of the database and the database itself. “The description of database. It includes description of database structure and the constraints that should hold on the database.” The database schema is specified during database design and is not expected to change frequently. e.g. Name: string StudentNumber: string Class: integer Major: string  Database schema (or meta-data)

7 Schemas VS. Instances  Schema diagram “A diagrammatic display of a database schema – structure of each record type (not the actual instances of a record).” NameStudentNumberClassMajor STUDENT CourseNameCourseNumberCreditHoursDepartment COURSE CourseNumberPrerequisiteNumber PREREQUITSITE SectionIdentifierCourseNumberSemesterYearInstructor SECTION StudentNumberSectionIdentifierGrade GRADE_REPORT

8 Schemas VS. Instances  Schema construct “An object within the schema.” e.g. STUDENT, COURSE.  Database instances “The actual data stored in a database at a particular moment in time. Also called database state or occurrence.” Many database instances can be constructed to correspond to a particular database schema.

9 Schemas VS. Instances DBMS catalog empty state Database initial state Data firstly loaded Database Update operation Database DBMS ensures valid state Define a new DB Specify DB schema

10 Schemas VS. Instances  Distinction The database schema does not frequently change, but the database state changes every time the database is updated. Schema is also called intension, whereas state is called extension.

11 Three-Schema Architecture  The goal of the three-schema architecture is to separate the user applications and the physical database.  The three-schema architecture was proposed to support DBMS characteristics of : Program-data independence. Supporting multiple views of the data.

12 Three-Schema Architecture  Schema can be defined at the following three level. 1) Internal schema at the internal level Describes physical storage structures and access paths. Typically uses a physical data model. 2) Conceptual schema at the conceptual level Describes the structure (such as entities, data type, relationship) and constraints for the whole database. Uses a conceptual or implementation data model. 3) External schemas at the external level Describes the various user views. Usually uses the same data model as the conceptual level.

13 Three-Schema Architecture Source: Elmasri R. & Navathe S.B. (1994) Fundamentals of database systems. External level Conceptual level Internal level EXTERNAL VIEW 1 EXTERNAL VIEW n END USERS CONCEPTUAL SCHEMA INTERNAL SCHEMA STORED DATABASE

14 Three-Schema Architecture  Programs refer to an external schema, and are mapped by the DBMS to the internal schema for execution.  Mappings among schema levels are needed to transform requests and data.  Notice that the three schemas are only descriptions of data; the only data that actually exists is at the physical level. If the request is a database retrieval, the data extracted from the stored database must be reformatted to match the user’s external view.

15 Data Independence  Two types of data independence: 1)Logical data independence The capacity to change the conceptual schema without having to change the external schemas and their application programs. 2)Physical data independence The capacity to change the internal schema without having to change the conceptual (or external) schema.

16 Data Independence  When a schema at a lower level is changed, only the mappings between this schema and higher-level schemas need to be changed in a DBMS that fully supports data independence.  The higher-level schemas themselves are unchanged. Therefore, the application programs need not be changed since they refer to the external schemas.

17 DBMS Language  Data Definition Language (DDL) is used by the DBA and by database designers to define the conceptual schema for the database and any mapping between the two.  Storage Definition Language (SDL) is used to specify the internal schema. Once the design of a database is completed and a DBMS is chosen to implement the database:  View Definition Language (VDL) are used to specify external schema - user views and their mappings to the conceptual schema.

18 DBMS Language Once the database schemas are compiled and the database is populated with data:  Data Manipulation Language (DML) are 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 or an Assembly Language.  In object-oriented systems, the host and data sublanguages typically form one integrated language such as C++.  Alternatively, a high-level DML used in stand-alone interactive manner is called a query language.

19 DBMS Language  Types of DML 1) Procedural DML (record-at-a-time or low-level DML) Must be embedded in a programming language. Typically retrieve individual records from the database, and use looping and other constructs of the host programming language to retrieve multiple records. Specify how to retrieve data. e.g. COBOL, C, etc.

20 DBMS Language 2) Declarative or Non-procedural DML (set-at-a-time or high-level DML) Use as a stand-alone query language or embedded in a programming language. Typically retrieves information from multiple related database records in a single command. Specify what data to retrieve than how to retrieve. Also called declarative languages. e.g. SQL

21 DBMS Interface  Stand-alone query language interfaces  Programmer interfaces for embedding DML in programming languages: 1) Pre-compiler Approach 2) Procedure Call Approach

22 DBMS Interface  User-friendly interfaces provided by a DBMS 1) Menu-based interface No need to memorize the specific commands and syntax of a query language. 2) Graphical interface Specify query via schema diagram and can be combined with menus. 3) Forms-based interface Usually programmed for parametric users to fill out the form entries to insert new data for creating canned transactions. 4) Natural language interface Accept and interpret requests written in English or some other language. 5) Combination of above

23 Other DBMS Interface  Interfaces for parametric users (e.g., bank tellers) Have a small set of operations.  Interface for the DBA Use function keys for minimizing number of keystrokes. Use privileged commands for creating accounts, setting system parameters, granting account authorization, changing schema, and reorganizing the storage structure of a database.  Speech as Input and Output  Web Browser as an interface

24 Database System Environment Source: Elmasri R. & Navathe S.B. (1994) Fundamentals of database systems

25 Database System Environment 1) Stored data manager controls access to DBMS information stored on disk. 2) DDL compiler processes schema definitions, specified in the DDL, and stores descriptions of the schemas (meta-data) in the DBMS catalog. It also compiles commands into object code for database access. 3) Run-time database processor handles database access at run time by executing the request. 4) Query compiler parses and analyzes a query. 5) Precomplier extracts DML commands from an application program written in a host programming language.  DBMS components modules are as follows. 6) DML complier compiles DML commands into object code for database access. The rest of the program is sent to the host language compiler.

26 Database System Utilities  Common database utilities have the following types of functions 1) Loading existing data files into the database. 2) Backing up copy of the database periodically. 3) Reorganizing database file structures to improve performance. 5) Monitoring database usage and providing statistics to the DBA.  Other functions, such as sorting, user monitoring, data compression, etc. 4) Report generation utilities.

27 Database System Utilities  Data dictionary is an important and very useful utility. Used to store schema descriptions and other information such as design decisions, application program descriptions, user information, usage standard, etc. Active data dictionary is accessed by DBMS s/w and users/DBA. Passive data dictionary is accessed by users/DBA only.  Combination of catalog/data dictionary:  Data dictionary vs. DBMS catalog

28 Database Architectures user network Application Database system user Application client Application server Database system network client server Two-tier architectureThree-tier architecture Source: Silberschatz A., Korth, H.F. & Sudarshan S. (2006) Database system concepts.

29 Database Architectures  Two Tier Client-Server Architectures Application on client machine invokes database system functionality at the server machine through query language statements. Application program interface like ODBC (Open Database Connectivity) and JDBC (Java Database Connectivity) are used for interaction.  Three Tier Client-Server Architectures Client machine communicates with application server only which means it does not contain any direct database calls. Application server communicates with a database system to access data. Appropriate for large applications, and web applications.

30 Classification of DBMS  Based on the data model used: Traditional: Relational, Network, Hierarchical Emerging: Object-oriented, Object-relational  Other classifications Single-user (typically used with micro-computers) vs. multi-user (most DBMSs). Centralized (uses a single computer with one database) vs. distributed (uses multiple computers, multiple databases) Distributed (or client server based database systems, a set of database servers supports a set of clients)

31 Classification of DBMS  Data model is the main criterion used to classify DBMS. 1) Relational data model represents a collection of tables. 2) Network model represents data as record types and limited type of 1:N relationship, called a set type. 3) Hierarchical model represents data as hierarchical tree structures. Each hierarchy represents a number of related records. 4) Object-oriented model defines a database in terms of objects, their properties, and their operations. Object with the same structure and behavior belongs to a class. 5) Object-relational model combines relational data model and object- oriented model to define complex data types.

32 Example of Relational Data Model Source: Elmasri R. & Navathe S.B. (1994) Fundamentals of database systems STUDENTNameStudentNumberClassMajor Smith171COSC Brown82COSC COURSECourseNameCourseNumberCreditHoursDepartment Intro to Computer ScienceCOSC13104COSC Data StructuresCOSC33204COSC Discrete MathematicsMATH24103MATH DatabaseCOSC33803COSC PREREQUISITECourseNumberPrerequisiteNumber COSC3380COSC3320 COSC3380MATH2410 COSC3320COSC1310

33 Example of Relational Data Model (Cont.) Source: Elmasri R. & Navathe S.B. (1994) Fundamentals of database systems SECTIONSectionIdentifierCourseNumberSemesterYearInstructor 85MATH2410Fall91King 92COSC1310Fall91Anderson 102COSC3320Fall92Knuth 112MATH2410Fall92Chang 119COSC1310Fall92Anderson 135COSC3380Fall92Stone GRADE_REPORTStudentNumberSectionIdentifierGrade 17112B 17119C 885A 892A 8102B 8135A

34 Example of a Network Schema Source: Elmasri R. & Navathe S.B. (1994) Fundamentals of database systems STUDENT GRADE_REPORT SECTION COURSE PREREQUISITE STUDENT_ GRADES SECTION_GRADES COURSE_OFFERINGS HAS_A IS_A

35 Example of a Hierarchical Schema Source: Elmasri R. & Navathe S.B. (1994) Fundamentals of database systems DNAMEDNUMBERMGRNAMEMGRSTARTDATE DEPARTMENT NAMESSNBDATEADDRESS EMPLOYEE PNAMEPNUMBERPLOCATION PROJECT


Download ppt "Instructors: Churee Techawut Introduction to Database System Chapter 1 CS (204)321 Database System I."

Similar presentations


Ads by Google