📚 A-Level CCEA Computer Science: Database Essentials | A-Level CCEA 计算机:数据库考点精讲
A database is a cornerstone of modern information systems, and CCEA’s A-Level Computer Science specification demands a thorough understanding of both theoretical foundations and practical skills. This revision guide breaks down every essential concept you need to master — from relational theory and normalisation to SQL and transaction management.
数据库是现代信息系统的基石,CCEA A-Level 计算机科学课程要求考生深入理解理论基础并掌握实用技能。本考点精讲将逐一拆解你必须掌握的所有核心概念——从关系理论、规范化到 SQL 和事务管理。
1. Database Concepts | 数据库概念
A database is a structured collection of data stored electronically. It allows efficient retrieval, modification, and management of information. Unlike a flat file, a database minimises redundancy and enforces data integrity.
数据库是电子化存储的结构化数据集合,能够高效地检索、修改和管理信息。与平面文件不同,数据库可最大限度减少冗余,并强制执行数据完整性。
The Database Management System (DBMS) is the software that interacts with end users, applications, and the database itself to capture and analyse data. Popular DBMS examples include MySQL, Oracle, and Microsoft SQL Server.
数据库管理系统 (DBMS) 是与最终用户、应用程序及数据库本身交互以捕获和分析数据的软件。常见的 DBMS 包括 MySQL、Oracle 和 Microsoft SQL Server。
CCEA often tests your understanding of the advantages of a database approach: data independence, shared data, controlled redundancy, and improved security. You should be able to contrast these with file-based systems.
CCEA 经常考查你对数据库方法优势的理解:数据独立性、共享数据、受控冗余和更高的安全性。你应当能够将数据库方法与基于文件的系统进行对比。
2. Relational Databases | 关系数据库
The relational model organises data into tables (relations) consisting of rows (tuples) and columns (attributes). Each table represents an entity type, and rows represent individual records. A column’s set of permissible values is its domain.
关系模型将数据组织成由行(元组)和列(属性)组成的表(关系)。每张表代表一种实体类型,行代表具体记录。列的允许取值集合称为域。
A primary key uniquely identifies each row in a table. It must be unique and not null. A foreign key is an attribute in one table that references the primary key of another table, establishing a link between them.
主键唯一标识表中的每一行,必须唯一且非空。外键是一个表中的属性,它引用另一个表的主键,从而在两者之间建立联系。
Candidate keys are attributes or combinations that could serve as the primary key. The term secondary key refers to an attribute used for data retrieval but not for uniqueness.
候选键是能够充当主键的属性或属性组合。辅助键则是指用于数据检索,但不保证唯一性的属性。
CCEA expects you to define these terms precisely and apply them to given tables. Ensure you can distinguish between an entity and a relation.
CCEA 要求你精确定义这些术语并能在给定表中加以应用。务必能区分实体和关系。
3. Entity-Relationship Modelling | 实体关系建模
Entity-Relationship (ER) diagrams are used to visually design a database before implementation. An entity is an object about which data is stored, and relationships show how entities interact.
实体关系 (ER) 图用于在实现前直观地设计数据库。实体是存储数据的对象,关系则体现实体之间如何交互。
Cardinality expresses the numerical constraints on a relationship: one-to-one (1:1), one-to-many (1:M), or many-to-many (M:N). Many-to-many relationships must be resolved with a linking table in the relational schema.
基数表示关系上的数量约束:一对一 (1:1)、一对多 (1:M) 或多对多 (M:N)。多对多关系必须在关系模式中通过链接表解析。
In CCEA exams, you may be asked to draw an ER diagram using standard notation. Use rectangles for entities, diamonds for relationships, and lines with crow’s foot or cardinality annotations.
在 CCEA 考试中,你可能需要绘制标准符号的 ER 图。实体用矩形表示,关系用菱形,连线标注鸟足符号或基数。
Always annotate primary keys and foreign keys in derived tables after mapping the ER model to a relational schema. This demonstrates your understanding of the logical design phase.
在将 ER 模型映射到关系模式后,务必标注派生表中的主键和外键,以展现你对逻辑设计阶段的理解。
4. Normalisation | 规范化
Normalisation is the process of organising data to eliminate redundancy and avoid anomalies. It involves applying a series of normal forms to a set of attributes.
规范化是组织数据以消除冗余、避免异常的过程,需要在一组属性上逐步应用各级范式。
First Normal Form (1NF) requires that every attribute contains atomic values, and there are no repeating groups. Each row must be uniquely identifiable.
第一范式 (1NF) 要求每个属性都包含原子值,且没有重复组。每行必须可唯一标识。
Second Normal Form (2NF) builds on 1NF; every non-key attribute must be fully functionally dependent on the primary key. Partial dependencies are removed by splitting the table.
第二范式 (2NF) 建立在 1NF 之上;所有非键属性必须完全函数依赖于主键。通过拆分表消除部分依赖。
Third Normal Form (3NF) requires that no non-key attribute is transitively dependent on the primary key. You achieve 3NF by moving such attributes to a new table along with the determinant.
第三范式 (3NF) 要求不存在非键属性对主键的传递依赖。通过将此类属性连同决定因子移至新表即可达到 3NF。
CCEA often provides a dataset with anomalies and asks you to normalise it step by step up to 3NF. Practice identifying partial and transitive dependencies quickly.
CCEA 经常提供一个含有异常的数据集,要求你逐步将其规范到 3NF。要练习快速识别部分依赖和传递依赖。
5. SQL Data Manipulation | SQL 数据操作
Structured Query Language (SQL) is the standard language for relational databases. The Data Manipulation Language (DML) subset includes SELECT, INSERT, UPDATE, and DELETE.
结构化查询语言 (SQL) 是关系数据库的标准语言。数据操作语言 (DML) 子集包括 SELECT、INSERT、UPDATE 和 DELETE。
A SELECT statement retrieves columns from one or more tables. The syntax is:
SELECT column1, column2 FROM table_name WHERE condition;
SELECT 语句从一张或多张表中检索列。基本语法如下:
SELECT column1, column2 FROM table_name WHERE condition;
Use INSERT INTO to add rows. Updating existing data requires the UPDATE command with a SET clause and often a WHERE clause to target specific rows.
使用 INSERT INTO 添加行。更新现有数据需要使用带有 SET 子句的 UPDATE 命令,并常通过 WHERE 子句指定特定行。
JOIN operations are crucial: INNER JOIN returns rows with matching values in both tables; LEFT JOIN returns all rows from the left table and matched rows from the right; RIGHT JOIN does the opposite. You must be able to write JOINs in CCEA SQL questions.
JOIN 操作至关重要:INNER JOIN 返回两表中匹配的行;LEFT JOIN 返回左表所有行及右表匹配行;RIGHT JOIN 与之相反。你必须能在 CCEA SQL 题中正确写出连接查询。
Aggregate functions such as COUNT, SUM, AVG, MAX, and MIN are often used with GROUP BY. HAVING filters grouped results, whereas WHERE filters individual rows before grouping.
聚合函数如 COUNT、SUM、AVG、MAX 和 MIN 常与 GROUP BY 结合使用。HAVING 过滤分组后的结果,而 WHERE 在分组前过滤各行。
6. SQL Data Definition | SQL 数据定义
Data Definition Language (DDL) commands define the database structure: CREATE, ALTER, and DROP. You must know how to create tables with constraints.
数据定义语言 (DDL) 命令用于定义数据库结构:CREATE、ALTER 和 DROP。务必掌握如何创建带约束的表。
A typical CREATE TABLE statement defines column names and data types (INT, VARCHAR, DATE, BOOLEAN). It also specifies primary key, foreign key, NOT NULL, UNIQUE, and CHECK constraints.
典型的 CREATE TABLE 语句定义列名和数据类型(INT、VARCHAR、DATE、BOOLEAN),同时指定主键、外键、NOT NULL、UNIQUE 和 CHECK 约束。
ALTER TABLE allows you to add, modify, or drop columns and constraints. DROP TABLE removes the entire table structure. CCEA may ask you to amend an existing schema via DDL.
ALTER TABLE 用于添加、修改或删除列和约束。DROP TABLE 移除整个表结构。CCEA 可能要求通过 DDL 修改现有模式。
Data types matter; choose appropriate ones to minimise storage and maintain accuracy. For example, use a TIMESTAMP for date and time rather than a character string.
数据类型的选择很重要,应选用恰当的类型以节省存储空间并保证准确性。例如,使用 TIMESTAMP 存储日期时间,而非字符串。
7. Data Integrity and Constraints | 数据完整性与约束
Data integrity ensures data is accurate, consistent, and reliable. The main types are entity integrity, referential integrity, and domain integrity.
数据完整性确保数据准确、一致且可靠。主要类型包括实体完整性、引用完整性和域完整性。
Entity integrity is enforced by the primary key: no null values are allowed in the primary key column. Referential integrity ensures foreign key values match an existing primary key or are null if allowed.
实体完整性由主键强制实现:主键列不能有空值。引用完整性确保外键值匹配某个现有主键值,或在允许时为空。
Domain integrity restricts the values a column can accept through data types, CHECK constraints, and default values. CCEA likes to link these constraints with normalisation questions.
域完整性通过数据类型、CHECK 约束和默认值限制列可接受的值。CCEA 喜欢将这些约束与规范化题目联系起来。
You should also understand cascading actions: ON DELETE CASCADE automatically deletes child rows when a parent row is deleted; ON UPDATE CASCADE propagates key changes.
你还应理解级联操作:ON DELETE CASCADE 在删除父行时自动删除子行;ON UPDATE CASCADE 传播键的更改。
8. Transaction Management | 事务管理
A transaction is a sequence of database operations treated as a single logical unit of work. It must satisfy the ACID properties: Atomicity, Consistency, Isolation, and Durability.
事务是作为单个逻辑工作单元处理的一系列数据库操作,必须满足 ACID 特性:原子性、一致性、隔离性和持久性。
Atomicity guarantees that either all operations in a transaction succeed, or none are applied. Consistency ensures the database remains in a valid state before and after the transaction.
原子性保证事务中的所有操作要么全部成功,要么全部未发生。一致性确保数据库在事务前后都处于有效状态。
Isolation means concurrent transactions do not interfere with each other. Durability ensures that once a transaction is committed, it persists even in the event of a system failure.
隔离性意味着并发事务互不干扰。持久性确保一旦事务提交,即使发生系统故障,其结果也能持久保存。
CCEA expects you to explain how rollback, commit, and savepoints work. Typically, a transaction starts with BEGIN and ends with COMMIT or ROLLBACK.
CCEA 要求你解释回滚、提交和保存点的工作机制。通常,事务以 BEGIN 开始,以 COMMIT 或 ROLLBACK 结束。
9. Concurrency Control | 并发控制
When multiple users access the database simultaneously, concurrency control techniques prevent data inconsistency. Lost updates, dirty reads, and non-repeatable reads are common problems.
当多个用户同时访问数据库时,并发控制技术可以防止数据不一致。常见问题包括丢失更新、脏读和不可重复读。
Locking is a primary mechanism: shared locks allow reading, while exclusive locks are needed for writing. Two-phase locking (2PL) ensures serialisability.
锁定是主要机制:共享锁允许读取,排他锁则用于写入。两阶段锁定 (2PL) 确保可串行化。
Timestamp ordering assigns a unique timestamp to each transaction and uses it to determine the execution order. It avoids deadlocks but may cause some transactions to be restarted.
时间戳排序为每个事务分配唯一时间戳并以此决定执行顺序。它可避免死锁,但可能导致部分事务被重启。
Deadlocks occur when two or more transactions are waiting indefinitely for each other’s locks. Detection and recovery strategies, such as timeout or wait-for graphs, are vital.
死锁发生在两个或多个事务无限期等待对方的锁时。检测和恢复策略,如超时或等待图,至关重要。
10. Database Security and Backup | 数据库安全与备份
Database security involves protecting data against unauthorised access and malicious attacks. Authentication (usernames/passwords) and authorisation (privileges) are fundamental.
数据库安全涉及保护数据免受非授权访问和恶意攻击。身份验证(用户名/密码)和授权(权限)是基本机制。
SQL’s GRANT and REVOKE commands manage privileges. A data owner can grant SELECT, INSERT, UPDATE privileges to users and later revoke them.
SQL 的 GRANT 和 REVOKE 命令管理权限。数据所有者可以向用户授予 SELECT、INSERT、UPDATE 权限,并随后撤销。
Backup and recovery strategies are essential for exam scenarios. A full backup captures the entire database; incremental backups record only the changes since the last backup.
备份与恢复策略是考试情景的关键。完整备份捕获整个数据库;增量备份仅记录自上次备份以来的更改。
CCEA may ask you to explain the role of a transaction log in point-in-time recovery. The log records all changes, enabling rollforward after a failure.
CCEA 可能要求你解释事务日志在时间点恢复中的作用。日志记录所有更改,支持故障后的前滚恢复。
11. Data Dictionaries and Metadata | 数据字典与元数据
A data dictionary is a structured repository of metadata — data about data. It stores definitions of tables, columns, data types, constraints, and relationships.
数据字典是元数据(关于数据的数据)的结构化存储库,保存表、列、数据类型、约束和关系的定义。
In CCEA’s syllabus, the data dictionary is part of the DBMS and is used during query optimisation and security checks. It ensures developers and DBAs have a consistent view of the schema.
在 CCEA 教学大纲中,数据字典是 DBMS 的一部分,用于查询优化和安全检查。它确保开发人员和数据库管理员对模式有一致的视图。
You should be able to describe the contents of a data dictionary: table names, column names, primary and foreign key information, index details, and stored procedures.
你应能描述数据字典的内容:表名、列名、主键和外键信息、索引详情以及存储过程。
12. Exam Technique and Common Pitfalls | 答题技巧与常见误区
For CCEA database questions, always read the scenario carefully to pick out entities, attributes, and relationships before designing an ER diagram or normalising.
回答 CCEA 数据库题时,务必仔细阅读情景设定,在绘制 ER 图或进行规范化前,先找出实体、属性和关系。
When normalising, explicitly state the dependencies and which normal form violations exist. Show each intermediate step clearly to gain full marks.
进行规范化时,要明确陈述依赖关系以及违反何种范式,并清楚展示每一个中间步骤,以获取满分。
In SQL writing questions, use consistent uppercase for keywords and ensure correct syntax. Double-check that JOIN conditions match the scenario’s cardinality.
在 SQL 写作题中,关键字统一使用大写,并确保语法正确。仔细检查 JOIN 条件是否符合情景的基数。
Avoid confusing data integrity types; a single mismatch in keys can lose marks. Practice explaining ACID with a short example for each property.
避免混淆数据完整性的类型;键的一个不匹配就可能失分。练习用简短例子分别解释 ACID 的每个特性。
Published by TutorHao | 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