📚 Understanding Databases for IGCSE Computer Science | 数据库详解:IGCSE计算机科学考点精讲
A database is a structured collection of data stored electronically. For IGCSE Computer Science, you need to understand how data is organised, how to use a database management system (DBMS), and how to manipulate data using queries. This article covers all the key concepts required by the Cambridge syllabus.
数据库是按一定结构电子化存储的数据集合。在IGCSE计算机科学中,你需要理解数据如何组织、如何使用数据库管理系统(DBMS),以及如何通过查询操作数据。本文覆盖剑桥考纲所要求的全部核心概念。
1. What is a Database? | 什么是数据库?
A database is an organised collection of data that can be easily accessed, managed and updated. It allows users to store large amounts of information efficiently and retrieve specific data quickly.
数据库是有组织的数据集合,便于访问、管理和更新。它允许用户高效地存储大量信息,并快速检索特定数据。
A flat-file database stores all data in a single table, while a relational database uses multiple tables that are linked by relationships. Relational databases are more powerful because they reduce duplication and improve consistency.
平面文件数据库将所有数据存储在一个表中,而关系数据库使用多个通过关系连接的表。关系数据库更强大,因为它减少重复并提高一致性。
Key terms to remember:
需要记忆的关键术语:
-
Database Management System (DBMS) – software that allows users to define, create and maintain a database.
数据库管理系统(DBMS)——允许用户定义、创建和维护数据库的软件。
-
Table – a collection of related records in a database.
表——数据库中相关记录的集合。
-
Query – a request for data from a database.
查询——对数据库中数据的请求。
2. Fields, Records and Files | 字段、记录与文件
In a database table, data is organised into fields, records and files:
在数据库表中,数据按字段、记录和文件组织:
| Term | 术语 | Definition | 定义 |
| Field | 字段 | A single piece of data, such as ‘StudentName’ or ‘DateOfBirth’. | 一条数据,如“学生姓名”或“出生日期”。 |
| Record | 记录 | A complete set of fields about one entity. | 关于一个实体的完整字段集合。 |
| File | 文件 | A collection of records. | 记录的集合。 |
For example, a school database might have a table called ‘Students’. Each row is a record (one student), and each column is a field (name, age, class).
例如,学校数据库可能有一个名为“学生”的表。每一行是一条记录(一名学生),每一列是一个字段(姓名、年龄、班级)。
3. Data Types | 数据类型
Each field in a database must be assigned a data type. The Cambridge syllabus expects you to choose the most appropriate data type for a given field.
数据库中的每个字段必须指定数据类型。剑桥考纲要求你能够为给定字段选择最合适的数据类型。
-
Text / String – stores letters, symbols and numbers that are not used in calculations (e.g. name, postcode).
文本/字符串——存储字母、符号和不参与计算的数字(如姓名、邮政编码)。
-
Number / Integer / Real – stores numeric values. Integer stores whole numbers; Real stores decimals.
数字/整数/实数——存储数值。整数存储整数;实数存储小数。
-
Date / Time – stores dates and times in a recognised format.
日期/时间——以识别格式存储日期和时间。
-
Boolean – stores TRUE or FALSE values.
布尔——存储TRUE或FALSE值。
-
Currency – stores monetary values.
货币——存储货币值。
A common exam question is: ‘State a suitable data type for the field DateOfBirth.’ The answer is ‘Date’.
常见考题是:“为出生日期字段写出合适的数据类型?”答案是“日期”。
4. Primary Keys and Foreign Keys | 主键与外键
A primary key is a field (or combination of fields) that uniquely identifies each record in a table. It cannot be empty and cannot be duplicated.
主键是能唯一标识表中每条记录的字段(或字段组合)。它不能为空,也不能重复。
A foreign key is a field in one table that refers to the primary key in another table. It is used to create relationships between tables.
外键是一个表中的字段,它引用另一个表中的主键。它用于创建表之间的关系。
For example, in a school database:
例如,在学校数据库中:
-
‘StudentID’ is the primary key in the Students table.
“学生ID”是学生表的主键。
-
‘StudentID’ appears as a foreign key in the Enrolment table.
“学生ID”在选课表中作为外键出现。
Relational databases use foreign keys to avoid data duplication. Only one copy of each student’s details is stored, other tables link to it.
关系数据库使用外键避免数据重复。每位学生的详细信息只存储一份,其他表通过外键链接到它。
5. Validation and Verification | 验证与校验
Validation checks whether data is sensible and within defined rules before it is accepted into a database. Verification checks whether data has been entered correctly from the original source.
验证在数据被接受进入数据库之前检查数据是否合理、是否符合规定规则。校验检查数据是否从原始来源被正确输入。
Common validation methods:
常见的验证方法:
-
Range check – checks that a value falls within a valid range (e.g. age 0 to 120).
范围检查——检查数值是否在有效范围内(如年龄0到120)。
-
Type check – checks that the data is of the correct type (e.g. no letters in a phone number).
类型检查——检查数据是否为正确类型(如电话号码中不能有字母)。
-
Length check – checks that a value has the correct number of characters.
长度检查——检查数值的字符数是否正确。
-
Presence check – checks that a field is not left blank.
存在性检查——检查字段是否为空。
-
Format check – checks that data matches a pattern (e.g. uppercase letters followed by two digits for a car registration).
格式检查——检查数据是否符合模式(如车牌字母大写后跟两位数字)。
Verification is often done by double entry – typing the data twice and comparing the two results.
校验通常通过双重输入完成——两次输入数据并比较结果。范
6. Searching and Sorting Data | 数据搜索与排序
Searching a database finds records that meet a specific condition. Sorting arranges records in ascending or descending order based on one or more fields.
搜索数据库是找出满足特定条件的记录。排序是根据一个或多个字段按升序或降序排列记录。
Queries can use logical operators to combine conditions:
查询可使用逻辑运算符组合条件:
-
AND – all conditions must be true (e.g. Age > 12 AND Class = ‘8A’).
与——所有条件必须为真(如年龄>12且班级=’8A’)。
-
OR – at least one condition must be true.
或——至少一个条件必须为真。
-
NOT – excludes records matching a condition.
非——排除符合某个条件的记录。
For example, to find all students who live in London and are in Year 10, the query would use: City = ‘London’ AND Year = 10.
例如,要查找住在伦敦且就读十年级的所有学生,查询条件为:城市=’伦敦’且年级=10。
7. SQL Basics | SQL基础
Structured Query Language (SQL) is used to create, update and query databases. You need to know the basic commands for the IGCSE exam.
结构化查询语言(SQL)用于创建、更新和查询数据库。你需要掌握IGCSE考试的基本命令。
Common SQL commands:
常用SQL命令:
-
SELECT– selects which fields to display.选择——选择要显示的字段。 -
FROM– specifies the table to query.从——指定要查询的表。 -
WHERE– adds a condition to filter records.哪里——添加条件筛选记录。 -
INSERT– adds a new record.插入——添加新记录。 -
DELETE– removes a record.删除——移除记录。 -
UPDATE– modifies existing data.更新——修改现有数据。
Example query:
示例查询:
SELECT Name, Age FROM Students WHERE Class = ‘8A’;
This displays the Name and Age fields for all students in Class 8A.
这条语句显示所有8A班学生的姓名和年龄字段。
8. Data Manipulation: Add, Delete and Edit | 数据操作:添加、删除与编辑
Databases are dynamic – records are constantly added, deleted and edited. Each operation must preserve data integrity.
数据库是动态的——记录不断被添加、删除和编辑。每个操作必须保持数据完整性。
-
Add record: insert a new row into a table using
INSERT INTO.添加记录:使用
插入到语句在表中插入新行。 -
Delete record: remove a row using
DELETE FROMwith aWHEREcondition to specify which record.删除记录:使用
从删除并附哪里条件来指定要删除的记录。 -
Edit record: change field values using
UPDATE ... SET.编辑记录:使用
更新...设置更改字段值。
Always use a unique condition (such as the primary key) when deleting or updating to avoid affecting multiple records.
删除或更新时务必使用唯一条件(如主键),以免影响多条记录。
9. Forms and Reports | 表单与报表
A form is a user-friendly interface for entering, editing and viewing records one at a time. Forms reduce errors by guiding users through the data entry process.
表单是一种用户友好的界面,用于一次一条地输入、编辑和查看记录。表单通过引导用户完成数据输入过程来减少错误。
A report is a formatted output of data, often used for printing or summarising information. Reports can include headings, totals, page numbers and grouping.
报表是数据的格式化输出,通常用于打印或汇总信息。报表可包含标题、总计、页码和分组。
Forms are used for input; reports are used for output. This distinction is often tested in exam questions.
表单用于输入;报表用于输出。这一区别常在考题中出现。
10. Advantages of Using a Database | 使用数据库的优势
Compared to storing data in spreadsheets or paper files, a well-designed database offers many benefits:
与使用电子表格或纸质文件存储数据相比,设计良好的数据库有很多优势:
-
Data consistency – updates only need to be made in one place; related tables automatically reflect the change.
数据一致性——只需在一个位置更新;相关表自动反映更改。
-
Reduced data redundancy – data is stored once, eliminating unnecessary duplication.
减少数据冗余——数据只存储一次,消除不必要的重复。
-
Data integrity – rules such as validation and primary keys ensure accuracy and reliability.
数据完整性——验证规则和主键确保准确性和可靠性。
-
Data security – access can be restricted to authorised users through passwords and user permissions.
数据安全——可通过密码和用户权限限制对授权用户的访问。
-
Efficient querying – large amounts of data can be searched and sorted quickly.
高效查询——可以快速搜索和排序大量数据。
-
Multi-user access – several users can view and update data simultaneously with proper locking mechanisms.
多用户访问——多个用户可以通过适当的锁定机制同时查看和更新数据。
On the other hand, databases require careful design, specialised software and can be complex to maintain – but their advantages usually outweigh these costs.
另一方面,数据库需要仔细设计、专业软件,且维护可能较为复杂——但其优势通常超过这些成本。
11. Common Exam Tips | 常见考试技巧
Here are practical tips to help you answer database questions in the Cambridge IGCSE exam:
以下实用技巧可帮助你在剑桥IGCSE考试中回答数据库题目:
-
Read the question carefully – if it asks for a ‘field name’, do not give an example value.
仔细审题——如果问“字段名”,不要给出示例值。
-
Use the correct terminology: field, record, table, primary key, foreign key.
使用正确的术语:字段、记录、表、主键、外键。
-
When writing SQL, keep the syntax simple and use single quotes around text values.
编写SQL时,保持语法简洁,并在文本值周围使用单引号。
-
Know the difference between validation and verification – validation checks rules, verification checks accuracy of entry.
区分验证与校验——验证检查规则,校验检查录入的准确性。
-
Practice writing queries for example tables until you are confident with SELECT, WHERE, INSERT, DELETE and UPDATE.
反复练习为示例表编写查询,直到你熟练掌握SELECT、WHERE、INSERT、DELETE和UPDATE。
Summary | 总结
Databases are a fundamental topic in IGCSE Computer Science. You need to understand the structure of tables, fields and records, use data types appropriately, apply primary and foreign keys, and write simple SQL statements. Mastering validation, verification, forms and reports will also help you score well in both theory and practical-style questions.
数据库是IGCSE计算机科学的基础专题。你需要理解表、字段和记录的结构,恰当使用数据类型,运用主键和外键,并编写简单的SQL语句。掌握验证、校验、表单和报表也将帮助你在理论题和实操题中取得高分。
Keep practising with example datasets and explain concepts in your own words – this builds the deep understanding that examiners look for.
持续使用示例数据集练习,并用你自己的语言解释概念——这将建立考官所看重的深入理解。
Published by TutorHao | IGCSE Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply