Contents What you should know by the end of this session...3 Reference :...3 Textbook...3 Database System Concepts...3 Principles of Distributed Database Systems (2nd Edition)...4 Data Mining : Concepts and Techniques...4 Course Outline...4 Contents of the Course...5 Course Work...6 Introduction to Databases...6 Age of Information Technology (IT)...6 What is a Database Management System?...8 Database...8 Database Management System (DBMS)...9 Why study databases?...9 Why not use file systems?... 10 The three-level architecture... 11 ANSI/SPARC - The three-level architecture... 12 Schemas vs Instances... 12 Schemas and Instances... 13 Levels of database schemas... 14 Data Independence... 15 Introduction... 15 Data Models... 16 Entity-Relationship Model... 17 Relational Model... 17 Data Definition Language (DDL)... 18 Data Manipulation Language (DML)... 19 SQL... 19 1
Database Users... 20 Database Administrator (DBA)... 20 Transaction Management... 21 Storage Management... 21 Overall System structure... 22 Application Architectures... 22 Summary... 25 2
What you should know by the end of this session Text books Marking Course Outline Course Content Expected Course Work An Introduction to DBMS (Review) Reference : 1) Database System Concepts 2010 Silberschatz, Korth, Sudarshan 2) Distributed DBMS -1998 M. Tamer Özsu & Patrick Valduriez 3) Data Mining: Concepts and Techniques 2006 - Jiawei Han and Micheline Kamber Textbook Database System Concepts Silberschatz, Korth, Sudershan 4 th Edition, 2002 5 th Edition, 2005 6 th Edition, 2010 McGraw Hill 3
Principles of Distributed Database Systems (2nd Edition) by M. Tamer Ozsu (Author), Patrick Valduriez (Author) Data Mining : Concepts and Techniques Jiawei Han and Micheline Kamber Morgan Kaufmann Publishers, 2006. Course Outline Review 4
XML Technology Data warehouse & Data mining - Distributed Databases - Database System Contents of the Course Review o DBMS o ER model and Relational model o Relational Algebra and SQL Technologies and Concepts o Web and Databases o XML o DDBMS o Distributed databases Knowledge Discovery o DataWare house o Data Mining DataBase System o Query processing, Query Optimization, o Concurrency, Transaction, Recovery, Parallel DBs 5
Course Work Design + Implement a web based DB XML and DBMS Data mining and Dataware House DDBMS Paper Review + Translation What you should know? Database Design Introduction to Databases What is a database management system? Why study databases? Why not use file systems? The three-level architecture Schemas and instances Data models, E-R model, Relational model Data Definition Language, Data Manipulation Language SQL Transaction Management, Storage Management User types, database administrator System Structure Age of Information Technology (IT) Organizations need good managers 6
Good managers need good information to make good decisions Good decisions require good information Good information rests on good database design Good information is derived from raw facts known as raw data Raw data require good efficient data management Efficient data management requires the use of a computer database system Data management focuses on o Data collection o Storage o Retrieval 7
What is a Database Management System? A DBMS is a : History o Collection of data Interrelated data + Meta data Relevant to some purpose o A Software to access the data Convenient Efficient o 1950s-60s: magnetic tape and punched cards o 1960s-70s: hard disks, random access, file systems o 1970s-80s: relational model becoming competitive o 1980s-90s: relational model dominant, object-oriented databases o 1990s-00s: web databases and XML Database Database resembles a very well organized electronic filing cabinet in which powerful software, known as a Database Management System (DBMS), helps manage the cabinet s content. More formally: o A database is a structure that houses a collection of data as well as data about data known as metadata 8
The metadata provides a description of data characteristics and the set of relationships that link the data found within the database Thus hiding much of the database s internal complexity from the database user Database Management System (DBMS) DBMS is a collection of programs that manages the database (DB) structure and controls access to the data stored in the DB DBMS is the database software bought commercially, thus can not make design changes in the DBMS DBMS is the intermediary-translating user requests into the complex code required to fulfill those requests Why study databases? They touch every aspect of our lives Applications: o Banking: all transactions o Airlines: reservations, schedules 9
o Universities: registration, course enrolment, grades o Sales: customers, products, purchases o Manufacturing: production, inventory, orders, supply chain o Human resources: employee records, salaries, tax deductions o Telecommunications: subscribers, usage, routing o Computer accounts: privileges, quotas, usage o Records: climate, stock market, library holdings Why not use file systems? Data redundancy and inconsistency o Multiple file formats o Duplication of information in different files Difficulty in accessing data o Need to write a new program to carry out each new task Data isolation o Multiple files and formats Integrity problems o Integrity constraints (e.g. account balance > 0) become part of program code o Hard to add new constraints or change existing ones Maintenance problems 10
o When we add a new field, all existing applications must be modified to ignore it Atomicity of updates o Failures may leave database in an inconsistent state with partial updates carried out o E.g. transfer of funds from one account to another should either complete or not happen at all Concurrent access by multiple users o Concurrent accessed needed for performance o Uncontrolled concurrent accesses can lead to inconsistencies E.g. two people reading a balance and updating it at the same time o Security problems Database systems offer solutions to all the above problems The three-level architecture Internal level: how a record is stored on disk Conceptual/Logical level: describes data stored in database, and the relationships among the data. type customer = record name : string; street : string; city : integer; end; 11
External/View level: application-specific selections and arrangements of the data hide details of data types Views can also hide information for security reasons ANSI/SPARC - The three-level architecture Schemas vs Instances Schema o the logical structure of the database o e.g., the database consists of information about a set of customers and accounts and the relationship between them o Analogous to type information of a variable in a program Instance o the actual content of the database at a particular point in time o Analogous to the value of a variable 12
Physical Data Independence o the ability to modify the physical schema without changing the logical schema o Applications depend on the logical schema o Database engines take care of efficient storage and query processing Schemas and Instances Schema is the structure of a database o intention or meaning of the data o data models are schemas o table definitions are schemas o class definitions are schemas Instances are the contents of a database o extension or values of the data o objects are instances o objects in a database are typically rows in a table This is another important distinction for students to make. In particular, models are schemas and databases are full of instances. 13
Levels of database schemas Different schemas are presented to different users External View 1 External View 2 External View 3 External level logical to external mappings Logical Schema Logical level disk internal to logical mapping Internal Schema Internal level The pictures at the top level indicate that some views are for users, some for reports and some for application programs. The logical level is where the data is seen as being composed of tables. At the physical level, files are stored on disk. The mappings are specified by developers and because of the capabilities of DBMSs, no programs must be written to support these levels. 14
Data Independence Logical data independence o Change in conceptual schema does not require change in external schemas o Expand or contract database with no change to external applications o View mappings must be changed Physical data independence o Change in internal schema does require change in conceptual schema o Reorganize the file and index structure, especially for improved performance o Conceptual mapping must be changed o the ability to modify the physical schema without changing the logical schema Emphasizing the importance of the previous diagram. Changes in one level are isolated to the interfaces between levels and don t have to be propagated. Introduction Overview of Database Technology o What is a database management system? o Why study databases? Why not use file systems? 15
o The three-level architecture o Schemas and instances o Data models, E-R model, Relational model o Data Definition Language, Data Manipulation Language o SQL o Transaction Management, Storage Management o User types, database administrator o System Structure Data Models A collection of tools for describing o data o data relationships o data semantics o data constraints Entity-Relationship model Relational model Other models: o object-oriented model o semi-structured data models (XML) o Older models: network model and hierarchical model 16
Entity-Relationship Model Example of schema in the entity-relationship model Relational Model Example of tabular data in the relational model 17
A Sample Relational Database Data Definition Language (DDL) Specification notation for defining the database schema o E.g. create table account ( account-number char(10), balance integer) 18
DDL compiler generates a set of tables stored in a data dictionary: o Database schema o Specification of storage structures and access methods Data Manipulation Language (DML) Language for accessing and manipulating the data organized by the appropriate data model o DML also known as query language Two classes of languages o Procedural user specifies what data is required and how to get those data o Nonprocedural user specifies what data is required without specifying how to get those data SQL is the most widely used query language SQL SQL: widely used non-procedural language o E.g. find the name of the customer with customer-id 192-83-7465 select customer.customer-name from customer where customer.customer-id = 192-83-7465 o E.g. find the balances of all accounts held by the customer with customer-id 192-83-7465 select account.balance from depositor, account 19
where depositor.customer-id = 192-83-7465 and depositor.account-number = account.account-number Application programs generally access databases through: o Language extensions to allow embedded SQL (e.g. PHP) o Application program interface (e.g. ODBC) which allow SQL queries to be sent to a database Database Users Users are differentiated by the way they expect to interact with the system Application programmers interact with system through DML calls Sophisticated users form requests in a database query language Specialized users write specialized database applications that do not fit into the traditional data processing framework ( GIS) Naïve users invoke one of the permanent application programs that have been written previously o E.g. people accessing database over the web, bank tellers, clerical staff Database Administrator (DBA) Coordinates all the activities of the database system; the database administrator has a good understanding of the enterprise s information resources and needs. Database administrator's duties include: o Schema definition 20
o Storage structure and access method definition o Schema and physical organization modification o Granting user authority to access the database o Specifying integrity constraints o Acting as liaison with users o Monitoring performance and responding to changes in requirements Transaction Management A transaction is a collection of operations that performs a single logical function in a database application o E.g. transfer funds from one account to another Transaction-management component ensures that the database remains in a consistent state despite system failures Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database. o E.g. simultaneous withdrawals Storage Management Storage manager is a program module that provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system. The storage manager is responsible to the following tasks: o interaction with the file manager 21
o efficient storing, retrieving and updating of data Overall System structure Application Architectures 22
Two-level architecture: E.g. client programs using ODBC/JDBC to communicate with a database Three-level architecture: E.g. web-based applications, and applications built using middleware 23
24
Summary Overview of Database Technology o What is a database management system? o Why study databases? Why not use file systems? o The three-level architecture o Schemas and instances o Data models, E-R model, Relational model o Data Definition Language, Data Manipulation Language o SQL o Transaction Management, Storage Management o User types, database administrator o System Structure 25