Database Terms t DBMS –Database Management System. A software used to organise, analyse, store,...
-
Upload
emma-sharp -
Category
Documents
-
view
218 -
download
0
Transcript of Database Terms t DBMS –Database Management System. A software used to organise, analyse, store,...
Database Terms
DBMS– Database Management System. A software use
d 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.
Database Terms
Record– a unit of storage in a database. In relational
database, the rows of table represent records.
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”.
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
Database
namestud_id dob
WinnieF00111 {02/14/83}
AmyF00112 {03/16/82}
SteveF00007 {10/28/83}
AmyF00246 {08/25/82}
Field
Record
Key
Database Design
Aims– to keep data integrity (correctness and
completeness) with the least for
• space• data duplication• updating efforts
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
Sample Address Book
Name:
Tele:
Address:
Sample Address Book
Name
Tele
Field name
Char.
Char.
Data type
158
Width
ADDRBOOK.DBF
Address Char. 40
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
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
Sample Student Report
SREPORT(stud_id, name, class,
sub_code, sub_desc, marks, ave_mk)
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
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
Database Terms
Data Integrity (數據完整性 )– refers to the correctness and completeness o
f information in the database.
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.
Data Normalisation
First Normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
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.
Sample Student Report
SREPORT(stud_id, name, class,
(sub_code, sub_desc, marks), ave_mk)
Data Normalisation
Deriving 1NF
SREPORT(stud_id, name, class, ave_mk)
MARKS(stud_id, sub_code,
sub_desc, marks)
Data Normalisation
Second Normal Form (2NF)– it is already in 1NF and if each non-key attribute
depends fully upon the key.
Data Normalisation
SREPORT(stud_id, name, class, ave_mk)
MARKS(stud_id, sub_code,
sub_desc, marks)
Data Normalisation
Deriving 2NF
SREPORT(stud_id, name, class, ave_mk)
MARKS(stud_id, sub_code, marks)
SUBJECT(sub_code, sub_desc)
Data Normalisation
Third Normal Form (3NF)– it is already in 2NF and if there is no dependency
between non-key attribute.
Data Normalisation
Deriving 3NF
SREPORT(stud_id, name, class, ave_mk)
MARKS(stud_id, sub_code, marks)
SUBJECT(sub_code, sub_desc)
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
Data Normalisation
Invoice(Inv_no, Cust_no, Cust_Addr,
Inv_date, (Item_code, Item_desc,
Item_price, Qty, Price), Total)
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)
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)
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)
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.
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.
Database Terms
Data Independence– refers to the data in a database which is
separated from the application programs that manipulate it.