Anda di halaman 1dari 4

Lions College F.

7 Computer Application Teaching Notes 2002-2003


Topic 4 Databases 數據庫 4.1 Concept and Terminology 概念及術語
Data versus Information 數據及信息的分別
data characteristics: independence, redundancy, integrity 數據特性:獨立性,冗餘,完整性
Database terminology: Database, file, record, field, base table, table, column, row 
數據庫術語:數據庫,檔案,記錄,欄,庫登記表,表,欄,列

Data versus Information 數據及信息的分別


Data is defined as the symbols used to represent information to be processed by
the computer. Data could be a set of no meaning random numbers, a phone number, or
a string of words. It may or may not make sense when read.
Information is the interpreted data that can be comprehensible by people and
contains meaning.
數據是一些符號用作表示電腦處理的信息,數據可以是一些沒有意義的隨
機數,電話號碼,或一些字串,有意義或沒有意義均可。
信息是一些經已翻譯有意義及可以理解的數據。

Data Characteristics 數據特性

Data Independence 數據獨立性


The structure of the database depends on the necessity of users. The setting is
independent from the application program. Users can search, reorganize, and retrieve
data in the database. Also, data can be added, delete, and change without requiring
change in programs.
數據庫的實質結構獨立於用戶需求,其設定也獨立於應用程序。用戶可檢索和重
新組織數據庫內的數據,然後提取資料。亦可隨意增加、删除或修訂數據,而不
影響程序運作

Data Redundancy 多餘數據

User stores data in the database only require to store in one location. Storing the same
field values more than once (unnecessarily) is referred to as data redundancy.
每用戶儲存自己數據在數據庫,祇需在一個位置貯存,便可供不同用戶使用。儲
存用樣數據多於一次便屬多餘數據(冗餘)。

Three problems are caused by data redundancy.


1. Storing values multiple times wastes space.
2. When a field value changes, multiple occurrences need to be updated.
3. If we forget to change the values in any of the records. The database would then
have inconsistent data.

53051131.doc 1
Lions College F.7 Computer Application Teaching Notes 2002-2003
Topic 4 Databases 數據庫 4.1 Concept and Terminology 概念及術語
Data versus Information 數據及信息的分別
data characteristics: independence, redundancy, integrity 數據特性:獨立性,冗餘,完整性
Database terminology: Database, file, record, field, base table, table, column, row 
數據庫術語:數據庫,檔案,記錄,欄,庫登記表,表,欄,列

冗餘數據有三個缺點:
1. 增加儲存時間及浪費儲存位置。
2. 如修改數據,不同檔案的數據要隨之更新。
3. 如忘記修改檔案內的數據,數據庫的數據便不協調。

Data Integrity 數據完整性


Data Integrity means the consistency of data. After processing or moving data, we
need to maintain data integrity. It includes to validate the content of in the database, to
compare and validate data between tables then update.
指數據的精確性及期望值的一致性,在數據移動或處理之後,在數據庫系統中
要 維護數據完整性。包括確認各個數據區內容、數據區之間的校核、將一個文件
或表格中的數據與另一個文件或表格進行比較,校對並進行確認。在經過處理之
後, 數據庫才被更新。

Database Terminology 數據庫術語

Database 數據庫
A database is a large repository of data. It can collect, index, store and display data
systematically. It can also combine related data together. Normally database is
controlled by a software package Database Management System (DBMS).
Information is retrieved, edited and stored using commands.
數據庫是一個儲存大量數據的儲存庫,能有系統地收集、分類、貯存和顯示數據
並能把相關的數據整理合併一起。通常是由數據庫管理系統控制(DBMS).

When data is stored in a computer, it is stored in files. Before any data is stored in a
database, a structure must be defined for the data file. For example, a student
information data file will consist the student name, class, class number, address,
telephone, parent names etc. Different records represent different students similar to a
table. Therefore, the data files in a database are also called base tables (tables).
數據儲存於電腦是以檔案型式儲存,數據儲存時,必須先設定數據檔案的結構。
例如一個學生的資料數據檔案會包括學生的姓名,班級,班號,地址,電話,
家長姓名等資料。不同的記錄代表不同學生如表格型式表示,所以數據檔案亦稱
為庫登記表(表)。

53051131.doc 2
Lions College F.7 Computer Application Teaching Notes 2002-2003
Topic 4 Databases 數據庫 4.1 Concept and Terminology 概念及術語
Data versus Information 數據及信息的分別
data characteristics: independence, redundancy, integrity 數據特性:獨立性,冗餘,完整性
Database terminology: Database, file, record, field, base table, table, column, row 
數據庫術語:數據庫,檔案,記錄,欄,庫登記表,表,欄,列

Fields, Records and Tables 欄、記錄、表


The database for Lions College can consist of a number of data files. For example,
one file is used to store the employee’ personnel information, one for the students
information, one for the students records, and for the school calendar.
獅子會中學的數據庫包括不同的數據檔案,例如:其中一檔案是用作儲存僱員
的個人資料,另一個儲存學生的資料,亦有一個儲存校曆表。

There are five teachers in Lions College. They are stored in the file teacher.dbf as
follows:
假設獅子會有5個教師,儲存於 teacher.dbf 檔案的資料如下:

Teacher Table
Rec# Class Name Address Phone
Record 1 1A Mr. Chan 20 Abc Street 1234567
Record 2 1B Miss Lee 130 Sai Yi Street 2345678
Record 3 1C Miss Wong 226 Prince Road 3456789
Record 4 1D Miss Lau 783 Hing Shing Road 4567891
Record 5 2A Mr. Chan 1 Nathan Road 5678912

The above data appear in the form of a table with 5 rows and 4 columns. Thus a
data file is also called a table. Each row corresponds to one record. Each column
corresponds to the data in the same field. A record represents one teacher data. In
each record, there are four fields, representing four pieces of information of a teacher.
上述的資料是用5列4欄的表形式排列,故數據檔案亦可稱為表。每列為一記錄
每欄儲存同一欄位數據。一個記錄代表一個教師的記錄。在每一記錄中,會有4
欄,代表一教師的資料。

Visual FoxPro uses fixed length records. In designing the structure of a table, we
need to specify the data type and the length of each field. The structure for the
teacher.dbf table is depicted as follows:
Visual FoxPro 用一個固定長度的記錄,在設計表的結構,要先決定數據的種類
及記錄的長度,教師的數據表是用下列的結構: 

53051131.doc 3
Lions College F.7 Computer Application Teaching Notes 2002-2003
Topic 4 Databases 數據庫 4.1 Concept and Terminology 概念及術語
Data versus Information 數據及信息的分別
data characteristics: independence, redundancy, integrity 數據特性:獨立性,冗餘,完整性
Database terminology: Database, file, record, field, base table, table, column, row 
數據庫術語:數據庫,檔案,記錄,欄,庫登記表,表,欄,列

Structure for table teacher.dbf


Field Field Name Type Width
1 CLASS Character 3
2 NAME Character 10
3 ADDRESS Character 20
4 PHONE Character 10

The records in the data file teacher.dbf can be accessed through the field CLASS,
NAME, ADDRESS, or PHONE. However, the field NAME not a good candidate for
accessing records, since Mr. Chan appears in both Record 1 and Record 5. The field
NAME has duplicated values or not unique
在 教 師 teacher.dbf 數 據 檔 案 的 數 據 可 以 用 欄 CLASS, NAME, ADDRESS, 或
PHONE。但欄位 NAME 不是一個選取記錄的好欄位,因為 Mr. Chan 在記錄1及
5均有出現,NAME 欄位有重覆的數據或者可以說不是單一記錄。

Exercise
1. Explain why a database file is often called a table ?
解釋數據檔案又叫表的原因?
2. What is data independence, data redundancy, data integrity ?
甚麼是數據獨立性,冗餘數據,完整數據?
3. What is the difference between a database and a database table ?
數據庫和表的分別是甚麼?
4. What are the three problems caused by data redundancy ?
冗餘數據產生的3個問題是甚麼?
5. Explain row and column in a database table ?
在數據庫中,列和欄的分別是甚麼?
6. Why do we need Database Management System (DBMS)?
為甚麼我們需要數據庫管理系統?

53051131.doc 4

Anda mungkin juga menyukai