database terms t dbms –database management system. a software used to organise, analyse, store,...

34
Database Terms DBMS – Database Management System. A softw are used to organise, analyse, store, retrieve, and edit information. – e.g., Visual FoxPro, Access

Upload: emma-sharp

Post on 18-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Terms

DBMS– Database Management System. A software use

d to organise, analyse, store, retrieve, and edit information.

– e.g., Visual FoxPro, Access

Page 2: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Terms

Database– collection of data organised for storage in a co

mputer memory. In relational database, information are stored in the form of table.

Page 3: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Terms

Record– a unit of storage in a database. In relational

database, the rows of table represent records.

Page 4: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Terms

Field– a data unit in a record. In relational database,

the columns of table represent fields. Since fields have different characteristics (numeric, character, date, etc.), they are also called “attributes”.

Page 5: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Terms

Key– a KEY is used to uniquely identify a record in

the database.

– a KEY can be a single field or combination of fields

Page 6: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database

namestud_id dob

WinnieF00111 {02/14/83}

AmyF00112 {03/16/82}

SteveF00007 {10/28/83}

AmyF00246 {08/25/82}

Field

Record

Key

Page 7: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Design

Aims– to keep data integrity (correctness and

completeness) with the least for

• space• data duplication• updating efforts

Page 8: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Design

Basic design– there must exist a KEY that uniquely determines

the entire record

– e.g., student identity that uniquely determines a student record

Page 9: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Sample Address Book

Name:

Tele:

Address:

Page 10: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Sample Address Book

Name

Tele

Field name

Char.

Char.

Data type

158

Width

ADDRBOOK.DBF

Address Char. 40

Page 11: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Sample Student Report

Student ID: f99007 Student Name: Wong Siu Fu

Average Mark: 60.25

Subject Code Subject Description. Marks

C01

E01

Chinese

English 62.00

64.00

M01 Mathematics...

86.00...

.

.

.

Class: 6F

Page 12: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Sample Student Report

stud_id

name

sub_code

sub_descmarks

ave_mk

Field name

Char.

Char.

Char.

Char.

Numeric

Numeric

Data type

6

25

3

15

3

6 (2 d.p.)

Width

SREPORT.DBF

class Char. 2

Page 13: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Sample Student Report

SREPORT(stud_id, name, class,

sub_code, sub_desc, marks, ave_mk)

Page 14: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Sample Student Report

Student ID: f99008 Student Name: Po King Wan

Average Mark: 60.25

Subject Code Subject Description. Marks

C01

E01

Chinese

English 60.00

66.00

M01 Mathematics...

72.00...

.

.

.

Class: 6F

Page 15: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Terms

Data Redundancy (冗餘數據 )– same data item exists in one or more databases.

– Disadvantage:• duplication causes wasted storage space• efforts to maintain common data up-to-date

Page 16: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Terms

Data Integrity (數據完整性 )– refers to the correctness and completeness o

f information in the database.

Page 17: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

a step-by-step process that is used to decompose a database into two or more databases

in order to avoid side effects during the operation of a database involving insertion, deletion and updating records.

Page 18: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

First Normal Form (1NF)

Second Normal Form (2NF)

Third Normal Form (3NF)

Page 19: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

First Normal Form (1NF)– if every attribute is based upon a simple, unique

value, i.e., there are no repeating groups of attribute types.

Page 20: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Sample Student Report

SREPORT(stud_id, name, class,

(sub_code, sub_desc, marks), ave_mk)

Page 21: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Deriving 1NF

SREPORT(stud_id, name, class, ave_mk)

MARKS(stud_id, sub_code,

sub_desc, marks)

Page 22: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Second Normal Form (2NF)– it is already in 1NF and if each non-key attribute

depends fully upon the key.

Page 23: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

SREPORT(stud_id, name, class, ave_mk)

MARKS(stud_id, sub_code,

sub_desc, marks)

Page 24: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Deriving 2NF

SREPORT(stud_id, name, class, ave_mk)

MARKS(stud_id, sub_code, marks)

SUBJECT(sub_code, sub_desc)

Page 25: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Third Normal Form (3NF)– it is already in 2NF and if there is no dependency

between non-key attribute.

Page 26: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Deriving 3NF

SREPORT(stud_id, name, class, ave_mk)

MARKS(stud_id, sub_code, marks)

SUBJECT(sub_code, sub_desc)

Page 27: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Sample Invoice

INVOICE NUMBER: 100486-300

Customer Number: C12345Customer Address: Hang Shin LinkInvoice Date: 04/01/99

Item Code Item Desc. Item Price Quantity Price

Total:

1123

1246

Chocolate

Coke

8.00

5.00

2

12 60.00

16.00

76.00

Page 28: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Invoice(Inv_no, Cust_no, Cust_Addr,

Inv_date, (Item_code, Item_desc,

Item_price, Qty, Price), Total)

Page 29: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Deriving 1NF

Invoice(Inv_no, Cust_no, Cust_Addr,

Inv_date, Total)

ItemDetails(Inv_no, Item_code, Item_desc,

Item_price, Qty, Price)

Page 30: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Deriving 2NF

Invoice(Inv_no, Cust_no, Cust_Addr,

Inv_date, Total)

ItemDetails(Inv_no, Item_code, Qty, Price)

Items(Item_code, Item_desc, Item_price)

Page 31: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Data Normalisation

Deriving 3NF

Invoice(Inv_no, Cust_no, Inv_date, Total)

Customer(Cust_no, Cust_Addr)

ItemDetails(Inv_no, Item_code, Qty, Price)

Items(Item_code, Item_desc, Item_price)

Page 32: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Partial Dependence

ItemDetails(Inv_no, Item_code,

Item_desc, Item_price, Qty, Price)

The non-key fields “Item_desc” and “Item_price” is dependent partly on the key, i.e., “Item_code”. This is known as partial dependence.

Page 33: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Transitive Dependence

Invoice(Inv_no, Cust_no, Cust_Addr,

Inv_date, Total)

The non-key field “Cust_Addr” is dependent on the non-key field “Cust_no”, this is known as transitive dependence.

Page 34: Database Terms t DBMS –Database Management System. A software used to organise, analyse, store, retrieve, and edit information. –e.g., Visual FoxPro, Access

Database Terms

Data Independence– refers to the data in a database which is

separated from the application programs that manipulate it.