Upload
sherman-owen
View
231
Download
3
Embed Size (px)
Citation preview
CSC2012 Database Technology&
CSC2513 Database Systems
2
Recommended texts
Essential:
Recommended: Raghu Ramakrishnan and Johannes Gehrke. Database Management
Systems. 0071151109 Some of my slides based on this book; covers DBMS internals (how to build a DBMS)
T Connolly & C Begg, Database Systems. A Practical Approach to Design, Implementation and Management, (either 3rd or 4th ed OK) Used for CSC2002 before
Background: R Elmasri & S B Navathe. Fundamentals of Database Systems.
0805317554
3
What is a Database?
A collection of data (and a description of this data), which is logically related Typically, designed to meet the information needs of an
organization.
Databases play a critical role in almost all areas where computers are used, including business, engineering, medicine, law, education, library, to name a few.
A database can be of any size and of varying complexity. the list of names and address of friends The book catalog of a large library may contain a million records A database of much greater size and complexity is maintained by the government
to keep track of the tax information filed by taxpayers.
4
Database Management System
DBMS (Database Management System): a software system that enables users to define, create, and maintain the database and that provides controlled access to this database.
Provides a Data Definition Language (DDL) Allows specification of data types, structures and any data
constraints.
Also provides a Data Manipulation Language (DML) General enquiry facility (query language) of the data. Most common query language: SQL (Structured Query Language)
5
DBMS -- Why Bother?
Alternative: File-based systems Collection of application programs that perform
services for the end users. Each program defines and manages its own data. Most languages support file operations
6
File-Based Systems – Limitations
Separation and isolation of data Each program maintains its own set of data. Users of one program may be unaware of potentially useful data
held by other programs.
Duplication of data Same data is held by different programs. Wasted space and potentially different values and/or different
formats for the same item.
7
File-Based Systems – Limitations
Data dependence File structure is defined in the program code.
Incompatible file formats Programs are written in different languages, and so cannot
easily access each other’s files.
Fixed Queries/Proliferation of application programs Programs are written to satisfy particular functions. Any new requirement needs a new program.
8
DBMS arose as a solution
Applications should not need to worry about how data is physically structured and stored
Applications should work with a logical data model and declarative query language
Data independence: the single most important reason behind the success of the DBMS today
9
Data Model
A collection of concepts/tools for describing conceptual structuring of data (data, data relationships and data constraints).
Relational model: the dominating one Data is stored in relations (basically tables with rows and
columns)
Relational database
A Turing Award for E. F. Codd
10
Data Model
Others: object-oriented model, object-relational model, etc. OO model OO database
Schema: a description of data in terms of a data model it defines the meaning of data
11
Declarative query language
Specifies what answers a query should return, but not how the query is executed
Leave the implementation details and optimization to DBMS
12
Three-Level Architecture
Three levels of data abstractions Need to separate each user’s view of the
database from its physical representation: All users should be able to access same data. Users should not need to know physical database storage
details. A user’s view must not be affected by changes made in other
users’ views Changes to physical storage should not affect database
structure or users’ views
13
Three-Level Architecture
14
Three-Level Architecture: External Level
Users’ view of the database.
Describes the part of database that is relevant to a particular user.
15
Three-Level Architecture: Conceptual Level
Community view of the database.
Describes what data is stored in database and relationships among the data.
16
Three-Level Architecture: Internal Level
Physical representation of the database on the computer.
Describes how the data is stored in the database.
17
Relating the Three Levels
18
Data Independence
Logical Data Independence Conceptual schema changes should not require changes to
external schema, or rewrites of application programs.
Physical Data Independence Internal schema changes (e.g. using different file organizations,
storage structures/devices) should not require change to conceptual or external schemas.
19
Data Independence
20
Other DBMS features
Besides data independence: Efficient data access Data integrity and security Data administration Concurrency control Crash recovery …
Overall: Reduced application development time
21
Major DBMS today
Oracle
DB2 (IBM)
SQL Server (Microsoft)
Sybase
Informix (acquired by IBM)
PostgreSQL (from UC Berkeley’s Ingres, Postgres)
MySQL Microsoft Access
22
People and Roles
End users Query/update databases through application user interfaces (e.g.,
Amazon.com, library catalogues, etc.)
Sophisticated users Those who form requests in database query language
Database designers Design database schema to model aspects of the real world
23
People and Roles
Database application developers Build applications that interface with databases
Database administrators (a.k.a. DBA’s) Load, back up, and restore data, fine-tune databases for
performance
DBMS developers Develop the DBMS or specialized data management software,
implement new techniques for query processing/optimization inside DBMS
24
After this course
At least, you should be a Sophisticated userDatabase designerDatabase application developer
25
The learning curve: a sketch
How to model real-world data using Entity/Relationship diagram? (Database design)
Relational model and how to translate E/R diagrams to the relational model? (Database design)
Relational algebra (Theory)
SQL (Data query, application development)
Normalisation (Database design, also a bit theory)
26
Summary
Database management system vs. file-based system Three-level architecture: external, conceptual, internal Data independence: logical, physical People and roles