Chapter 1 Introduction Data n n n Banking

Chapter 1 Introduction

Data n n n Banking: For customer information, accounts, loans & other banking transactions Airlines: For reservation & schedule information Universities: For student information, course registration, grades etc.

What is a database? n n A structured collection of related data An filing cabinet, an address book, a telephone directory, a timetable, etc. n Google and your email is a database n School Student Information System

Database Management System (DBMS) n n n Collection of interrelated data Set of programs to access the data DBMS contains information about a particular enterprise DBMS provides an environment that is both convenient and efficient to use. Database Applications: n n n n Banking: all transactions Airlines: reservations, schedules Universities: registration, grades Sales: customers, products, purchases Manufacturing: production, inventory, orders, supply chain Human resources: employee records, salaries, tax deductions Databases touch all aspects of our lives

The DBMS Manages the Interaction Between the End User and the Database

Using file system for storing data n Tập tin File Chương trình ứng dụng 1 Quản lý dữ liệu Chương trình ứng dụng 2 Quản lý dữ liệu Tập tin Hệ Thống Quản Lý Tập Tin Tập tin Chương trình ứng dụng 3 Quản lý dữ liệu Tập tin Dữ liệu

Using file system for storing data Disadvantages: n n n n Data redundancy and inconsistency (dư thừa dữ liệu và tính không nhất quán). Difficulty in Accessing data (Khó khăn trong việc truy xuất dữ liệu) Data isolation (sự cô lập dữ liệu). Integrity Problems(vấn đề toàn vẹn). Concurrent access Problems(vấn đề truy xuất đồng thời). Atomicity problems (vấn đề về tính nguyên tử). Security problems (vấn đề an toàn)

Advantages of the Database Approach n Database Chương trình ứng dụng 1 Quản lý dữ liệu Chương trình ứng dụng 2 Quản lý dữ liệu Chương trình ứng dụng 3 Quản lý dữ liệu Hệ Quản Trị CSDL

Advantages of the Database Approach n n n n n Program-data independence (độc lập) Planned data redundancy(dư thừa) Improved data consistency(vững chãi) Improved data sharing Increased application development productivity Enforcement of standards Improved data quality Improved data accessibility and responsiveness Reduced program maintenance(giảm bớt việc bảo quản) Improved decision support

Elements of the Database Approach n Data models n n Relational Databases n n Database technology involving tables (relations) representing entities and primary/foreign keys representing relationships Use of Internet Technology n n Graphical system capturing nature and relationship of data Enterprise Data Model–high-level entities and relationships for the organization Project Data Model–more detailed view, matching data structure in database or data warehouse Networks and telecommunications, distributed databases, clientserver, and 3 -tier architectures Database Applications n Application programs used to perform database activities (create, read, update, and delete) for database users

Data Models n n n Entity-Relationship model Relational model Other models: object-oriented model n semi-structured data models n Older models: network model and hierarchical model n

Entity-Relationship Model

Relational Model

Data Models n n Data Abstraction: hiding details of data storage that are not needed for most database users. There are several levels of abstraction:

Physical Level n n n How the data are stored. Lowest level of abstraction. Complex low-level structures described in detail. Deals with physical storage of data • Structure of records on disk - files, pages, blocks • Indexes and ordering of records • Used by database system programmers • Internal Schema Example: RECORD EMP LENGTH=44 HEADER: BYTE(5) OFFSET=0 NAME: BYTE(25) OFFSET=5 SALARY: FULLWORD OFFSET=30 DEPT: BYTE(10) OFFSET=34

Conceptual Level n n n Next highest level of abstraction. Describes what data are stored. Describes the relationships among data. Database administrator level. Deals with the organisation of the data as a whole • Abstractions are used to remove unnecessary details of the internal level • Used by DBAs and application programmers Example: CREATE TABLE Employee ( Name VARCHAR(25), Salary REAL, Dept_Name VARCHAR(10))

View Level Highest level. n Describes part of the database for a particular group of users. n Can be many different views of a database. n E. g. tellers in a bank get a view of customer accounts, but not of payroll data. n Provides a view of the database tailored to a user • Parts of the data may be hidden • Data is presented in a useful form • Used by end users and application programmers Example: n n n Payroll: String Name double Salary n Personnel: char *Name char *Department

Example

The Database System Environment n Database system is composed of 5 main parts: 1. 2. Hardware Software n n n 3. 4. 5. Operating system software DBMS software Application programs and utility software People Procedures Data

The Database System Environment

DBMS Functionality n n n n Define a particular database in terms of its data types, structures, and constraints Construct or Load the initial database contents on a secondary storage medium Manipulating the database: Retrieval: Querying, generating reports Modification: Insertions, deletions and updates to its content Accessing the database through Web applications Processing and Sharing by a set of concurrent users and application programs – yet, keeping all data valid

DBMS Functionality Other features: n Protection or Security measures to prevent n unauthorized access n “Active” processing to take internal actions on data n Presentation and Visualization of data n Maintaining the database and associated programs over the lifetime of the database application n Called database, software, and system maintenance

Role and Advantages of DBMS n End users have better access to more and better-managed data – Promotes integrated view of organization’s operations – Probability of data inconsistency is greatly reduced – Possible to produce quick answers to queries

Database system architecture n The three levels – not necessarily for a relational system n Internal level (storage level) – closest to physical storage n n n External level ([individual] user logical level) – closest to users n n n Concerned with the way the data is stored inside the system One/Implementation level Concerned with the way the data is seen by individual users Many/Model level Conceptual level ([community] logical level) n n Indirection between the above two levels One/Model level

Database system architecture

Example
- Slides: 26