數據控制/管理 Data Control: 例子
垃圾 Garbage In Garbage Out (GIGO)
若輸入的數據有錯誤(或不完整),會產生錯誤的結果。

(A) 數據校驗 Data Verification:

1.檢查複核 Double Check (人手進行)

確保沒有『抄錄』錯誤

2.重複輸入 Double Entry

舊密碼 Old password: ********

新密碼 New password (1):

新密碼 New password (2):


(B) 有效性檢驗 Data Validation: (由程式執行)

1. 範圍檢查 Range Check (Reasonableness) e.g. 0-100, 1-12, A-E

2. 類型檢查 Data Type Check (int/char) e.g. abc, 123

3. 長度檢查 Length Check e.g. 1A01, HKID:A123456(3)

4. 檢查數位 Check Digit e.g. A123456(3), ISBN:962-001-006-X, VISA

5. 完整性/存在檢查(檢查有否輸入) Completeness/Presence Check

6. 一致性檢查 Consistency Check e.g. 煤氣錶讀數:1314, 9999

7. 唯一檢查(獨一無二) Uniqueness Check e.g. 註冊編號

8. 控制(批次)總和 Control (Batch) Total e.g. 每10張單據一批:$3450, $9500, ...


(C) Choose the best method of Validation / Verification for each of the following data:
1.英文姓名 Name in English
2.性別 Gender (M/F)
3.出生日期 DOB
4.身份証號碼 ID Card#
5.電話號碼 phone#
6.國際標準書號 ISBN
7.商品條碼 EAN13
8.年齡 Age (0-99)
9.分數 Score (0-100)
10.等級 Grade (A-E)
11.婚姻狀況 Marital Status (S,M)
12.體重 weight (kg)
13.身高 height (cm)
14.水錶讀數(9999) meter reading
15.註冊編號 registration#
16.支票銀碼總額 cheque amounts
17.銀行帳戶號碼 bank a/c#
18.班號 Class Number
19.電郵地址 email address
20.住址 Address

1.範圍檢查

2.類型檢查

3.長度檢查

4.檢查數位

5.完整性/存在檢查

6.一致性檢查

7.唯一檢查

8.控制(批次)總和

Ans: 2,1,1,4,2, 4,4,1,1,1, 1,2,2,6,1, 7,4,A2,2,5

https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Guide/Regular_Expressions