26
CSC2012 Database Technology & CSC2513 Database Systems

CSC2012 Database Technology & CSC2513 Database Systems

Embed Size (px)

Citation preview

Page 1: CSC2012 Database Technology & CSC2513 Database Systems

CSC2012 Database Technology&

CSC2513 Database Systems

Page 2: 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

Page 3: CSC2012 Database Technology & CSC2513 Database Systems

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.

Page 4: CSC2012 Database Technology & CSC2513 Database Systems

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)

Page 5: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 6: CSC2012 Database Technology & CSC2513 Database Systems

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.

Page 7: CSC2012 Database Technology & CSC2513 Database Systems

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.

Page 8: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 9: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 10: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 11: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 12: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 13: CSC2012 Database Technology & CSC2513 Database Systems

13

Three-Level Architecture

Page 14: CSC2012 Database Technology & CSC2513 Database Systems

14

Three-Level Architecture: External Level

Users’ view of the database.

Describes the part of database that is relevant to a particular user.

Page 15: CSC2012 Database Technology & CSC2513 Database Systems

15

Three-Level Architecture: Conceptual Level

Community view of the database.

Describes what data is stored in database and relationships among the data.

Page 16: CSC2012 Database Technology & CSC2513 Database Systems

16

Three-Level Architecture: Internal Level

Physical representation of the database on the computer.

Describes how the data is stored in the database.

Page 17: CSC2012 Database Technology & CSC2513 Database Systems

17

Relating the Three Levels

Page 18: CSC2012 Database Technology & CSC2513 Database Systems

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.

Page 19: CSC2012 Database Technology & CSC2513 Database Systems

19

Data Independence

Page 20: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 21: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 22: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 23: CSC2012 Database Technology & CSC2513 Database Systems

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

Page 24: CSC2012 Database Technology & CSC2513 Database Systems

24

After this course

At least, you should be a Sophisticated userDatabase designerDatabase application developer

Page 25: CSC2012 Database Technology & CSC2513 Database Systems

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)

Page 26: CSC2012 Database Technology & CSC2513 Database Systems

26

Summary

Database management system vs. file-based system Three-level architecture: external, conceptual, internal Data independence: logical, physical People and roles