Database Key Points for IGCSE WJEC Computer Science | IGCSE WJEC 计算机:数据库考点精讲

📚 Database Key Points for IGCSE WJEC Computer Science | IGCSE WJEC 计算机:数据库考点精讲

A database is an organised collection of structured data, typically stored electronically in a computer system. For the IGCSE WJEC Computer Science exam, it is essential to understand how databases are designed, how they ensure data consistency, and how to manipulate data using Structured Query Language (SQL). This article breaks down the key points you need to master, from terminology to practical query writing.

数据库是一种有组织的结构化数据集合,通常以电子方式存储在计算机系统中。对于 IGCSE WJEC 计算机科学考试,必须理解数据库的设计方式、如何确保数据一致性,以及如何使用结构化查询语言 (SQL) 操作数据。本文拆解了需要掌握的考点,从术语到实际查询编写。

1. What is a Database? | 什么是数据库?

A database is a structured set of data held in a computer, accessible in various ways. It eliminates the problems of traditional file-based systems such as data duplication and inconsistency. The most common type is the relational database, where data is stored in tables linked by key fields.

数据库是计算机中存放的一组结构化数据,可以通过多种方式访问。它消除了传统文件系统的问题,如数据重复和不一致。最常见的类型是关系型数据库,数据存储在表中,并通过关键字段相互关联。


2. Database Terminology | 数据库术语

The basic building blocks of any database are fields, records, and tables. A field is a single piece of data, such as a person’s name. A record is a complete set of fields describing one entity, like all details of one student. A table is a collection of records with the same fields. Understanding these terms is crucial for designing databases.

任何数据库的基本构建块是字段、记录和表。字段是一条单独的数据,例如一个人的姓名。记录是描述一个实体的完整字段集合,如一个学生的全部详细信息。是具有相同字段的记录集合。理解这些术语对于数据库设计至关重要。


3. Primary Keys and Foreign Keys | 主键与外键

Every table should have a primary key, a field that uniquely identifies each record. No two records can have the same primary key value, and it cannot be null. A foreign key is a field in one table that refers to the primary key of another table, creating a link between the two. This relationship is the foundation of relational databases.

每个表都应该有一个主键,它是唯一标识每条记录的字段。两条记录不能有相同的主键值,且主键不能为空。外键是一个表中的字段,它引用另一个表的主键,从而在两个表之间建立联系。这种关系是关系型数据库的基础。


4. Relational Databases | 关系型数据库

A relational database organises data into multiple tables that are linked by key fields. This approach reduces data duplication and improves data integrity. For example, a school database might have a Students table and a Courses table, linked by a StudentID foreign key in the Enrolment table, rather than repeating student details in every course record.

关系型数据库将数据组织到多个通过关键字段连接的表中。这种方法减少了数据重复,提高了数据完整性。例如,学校数据库中可能有学生表和课程表,通过选课表中的 StudentID 外键关联,而不是在每个课程记录中重复学生详细信息。


5. Reducing Data Redundancy | 减少数据冗余

Data redundancy occurs when the same piece of data is stored in multiple places. This wastes storage space and can lead to inconsistencies. Relational databases minimise redundancy through a process called normalisation, which involves separating data into related tables and using foreign keys. For the exam, you should be able to explain why redundancy is bad and how normalisation helps.

当同一数据片段存储在多个位置时,就会发生数据冗余。这浪费存储空间并可能导致不一致。关系型数据库通过规范化过程最小化冗余,该过程将数据分离到相关表中并使用外键。对于考试,你应该能够解释冗余为何不利以及规范化如何提供帮助。


6. Data Integrity | 数据完整性

Data integrity means that data is accurate, consistent and valid. Relational databases enforce integrity through several mechanisms: entity integrity ensures each table has a primary key that is unique and not null; referential integrity ensures that foreign key values must match an existing primary key or be null; and validation rules check data upon entry (e.g., a date of birth cannot be in the future).

数据完整性意味着数据是准确、一致且有效的。关系型数据库通过多种机制强制完整性:实体完整性确保每个表都有一个唯一且非空的主键;参照完整性确保外键值必须匹配现有的主键或为空;验证规则在数据输入时进行检查(例如,出生日期不能是未来的日期)。


7. Introduction to SQL | SQL 简介

SQL (Structured Query Language) is used to communicate with a database. It is the standard language for relational database management systems. You need to know the main SQL commands for data retrieval and manipulation: SELECT, FROM, WHERE, ORDER BY, INSERT INTO, UPDATE, and DELETE. WJEC expects you to write and interpret basic SQL statements.

SQL(结构化查询语言)用于与数据库通信。它是关系型数据库管理系统的标准语言。你需要了解用于数据检索和操作的主要 SQL 命令:SELECTFROMWHEREORDER BYINSERT INTOUPDATEDELETE。WJEC 希望你会编写和解读基本的 SQL 语句。


8. Retrieving Data with SELECT | 使用 SELECT 查询数据

The SELECT statement is used to fetch data from a database. The result is stored in a result-set called a record set. A basic query selects specific columns from a table: SELECT column1, column2 FROM table_name;. To select all columns, use SELECT * FROM table_name;. You should be able to write a query to display certain fields.

SELECT 语句用于从数据库中获取数据。结果存储在一个称为记录集的结果集中。基本查询从表中选择特定列:SELECT column1, column2 FROM table_name;。要选择所有列,使用 SELECT * FROM table_name;。你应该能够编写查询来显示特定字段。


9. Filtering with WHERE | 使用 WHERE 过滤

The WHERE clause is used to filter records that satisfy a specific condition. Operators like =, > (greater than), < (less than), AND, OR and NOT can be applied. For example: SELECT Name, Age FROM Students WHERE Age >= 16; retrieves students aged 16 or over. String comparisons use single quotes: WHERE City = 'London'. LIKE is used for pattern matching: WHERE Name LIKE 'J%' finds names starting with J.

WHERE 子句用于过滤满足特定条件的记录。可以使用诸如 =>(大于)、<(小于)、ANDORNOT 等运算符。例如:SELECT Name, Age FROM Students WHERE Age >= 16; 检索年龄在 16 岁及以上的学生。字符串比较使用单引号:WHERE City = 'London'LIKE 用于模式匹配:WHERE Name LIKE 'J%' 找到以 J 开头的名字。


10. Sorting with ORDER BY | 使用 ORDER BY 排序

The ORDER BY clause sorts the result set in ascending (ASC, default) or descending (DESC) order. You can sort by multiple columns: SELECT * FROM Products ORDER BY Price DESC, Name ASC;. This sorts primarily by price (highest first), then alphabetically by name for ties. For the exam, you must be able to specify sort direction and combine it with WHERE.

ORDER BY 子句将结果集按升序(ASC,默认)或降序(DESC)排序。可以按多列排序:SELECT * FROM Products ORDER BY Price DESC, Name ASC;。这先按价格降序排列,价格相同时按名称升序排列。考试时你必须能够指定排序方向并将其与 WHERE 结合使用。


11. Modifying Data: INSERT, UPDATE, DELETE | 修改数据:INSERT, UPDATE, DELETE

Data manipulation involves adding, changing or removing records. INSERT INTO adds a new row: INSERT INTO Students (ID, Name, Age) VALUES (101, 'Alice', 15);. UPDATE modifies existing data: UPDATE Students SET Age = 16 WHERE ID = 101;. DELETE removes rows: DELETE FROM Students WHERE ID = 101;. Be careful: omitting WHERE in UPDATE or DELETE affects all rows!

数据操作包括添加、更改或删除记录。INSERT INTO 添加一行新记录:INSERT INTO Students (ID, Name, Age) VALUES (101, 'Alice', 15);UPDATE 修改现有数据:UPDATE Students SET Age = 16 WHERE ID = 101;DELETE 删除行:DELETE FROM Students WHERE ID = 101;。注意:在 UPDATEDELETE 中省略 WHERE 会影响到所有行!


12. Database Management Systems (DBMS) | 数据库管理系统 (DBMS)

A Database Management System (DBMS) is software that allows users to create, manipulate and administer databases. Examples include Microsoft Access, MySQL, and SQLite. The DBMS handles data storage, security, backup, and concurrency. For WJEC, you should know the role of a DBMS in enforcing data integrity and providing query facilities, as well as the difference between a database and a DBMS.

数据库管理系统 (DBMS) 是允许用户创建、操作和管理数据库的软件。例子包括 Microsoft Access、MySQL 和 SQLite。DBMS 处理数据存储、安全、备份和并发控制。对于 WJEC,你应该了解 DBMS 在强制数据完整性和提供查询功能方面的作用,以及数据库与 DBMS 之间的区别。

Published by TutorHao | Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading