Database structure and forms
Đã giới thiệuTrong bài học này
| English | Ý nghĩa |
|---|---|
| primary key/ˈpraɪməri kiː/ | A field or combination of fields that uniquely identifies each record in a database table. |
| foreign key/ˈfɒrən kiː/ | A field or group of fields that refers to a candidate key in another or the same database table. |
| redundancy/rɪˈdʌndənsi/ | Additional or repeated data, capacity or components beyond what is strictly necessary, sometimes provided for reliability. |
| radio button | |
| check box | |
| relational database/rɪˈleɪʃənl ˈdeɪtəbeɪs/ |
Tables that talk to each other
- A database table holds records (rows) made of fields (columns). Linking tables avoids repeating data.
Data types
| type | use | formats |
|---|---|---|
| text | names, codes, phone numbers | |
| numeric | quantities, prices | decimals, %, currency |
| date/time | dates, times | 25/02/2026, 14:30 |
| Boolean | two values | yes/no, checkbox |
- Data can be imported from .csv or .txt.
Match each field to the best data type.
Độ khó 2/5 · 140 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Phone numbers are text because they are not calculated and may start with 0.
A primary key value can be repeated in a table.
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
It must be unique for each record.
Keys
- A primary key 主键 is unique for each record and identifies it.
- A foreign key 外键 is another table's primary key; it links the tables in a relationship.
Books(BookID, Title, Author) and Loans(LoanID, BookID, MemberID, DateOut): LoanID is the primary key of Loans; BookID is a foreign key in Loans.
In Loans(LoanID, BookID, MemberID, DateOut), what is BookID?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
It is the primary key of Books, linking the tables.
Which are advantages of a relational database over a flat file?
Độ khó 2/5 · 140 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Flat files are simpler to set up.
Flat file or relational?
| flat file | relational |
|---|---|
| one table | linked tables |
| simple | more complex design |
| repeated data (redundancy 冗余) | shared details stored once |
| can become inconsistent | change once, correct everywhere |
Which form control lets the user choose exactly one option?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Check boxes allow several.
Data entry forms
- Title, instructions, logical order, white space, clear font.
- Radio buttons 单选按钮 (one choice), check boxes 复选框 (several), drop-down menus reduce typing errors; navigation buttons.
Phone numbers are text, not numbers. They are not calculated, and a number field drops the leading 0.
Choose the right data type for each field. A primary key is unique; a foreign key links tables. Relational databases 关系型数据库 cut redundancy. Forms use controls that limit typing.
Đã xảy ra vấn đề gì? Chỉ đội ngũ trang web nhìn thấy thông tin này.