LEARNING OBJECTIVES
What you will be able to do
- describe fields, records, data types and primary keys
- explain validation and relational database advantages
- write SELECT queries with filtering and ordering
- construct truth tables and logic circuits
AT A GLANCE
INTRODUCTION · THE BIG IDEA
Design relational data, write precise SQL queries and reason with logic gates.
Databases store structured records so information can be searched, updated and reported reliably. Keys and validation protect identity and data quality.
Boolean logic reduces decisions to true and false. The same AND, OR and NOT operations appear in conditions, truth tables and physical logic circuits.
SECTION 01
Database structure and keys
A field stores one attribute and a record stores the fields for one entity. Suitable types include text, integer, real, date/time and Boolean. Field length and type reduce waste and prevent invalid operations.
A primary key must be unique and never null. A foreign key stores a matching primary-key value from another table, creating a relationship and reducing duplicated data. Referential integrity prevents references to missing records.
| Term | Meaning |
|---|---|
| Field | one attribute such as DateOfBirth |
| Record | all stored fields for one entity |
| Primary key | unique record identifier |
| Foreign key | field linking to another table's primary key |
SECTION 02
Validation and database use
Range, type, format, length, presence and check-digit validation reject input that breaks rules. Verification checks copied data. Database systems support concurrent access, security permissions, backup, data independence and powerful queries.
A flat file repeats details and creates update, insertion and deletion anomalies. Related tables reduce redundancy but require thoughtful keys, relationships and query design.
SECTION 03
SQL queries
SELECT chooses fields, FROM names the table and WHERE filters records. AND requires both conditions; OR requires at least one. ORDER BY sorts the result using ASCENDING or DESCENDING as required by the current syllabus notation.
Text criteria use quotation marks. Numeric criteria do not. A result can select several fields while filtering using another field.
Filter and order a result
- Required fields are Name and Score from Students.
- Keep students with Score >= 70 AND House = "Blue".
- Order highest score first.
Answer: SELECT Name, Score FROM Students WHERE Score >= 70 AND House = "Blue" ORDER BY Score DESCENDING
SECTION 04
Boolean logic and gates
AND outputs 1 only when both inputs are 1. OR outputs 1 when at least one input is 1. NOT reverses its input. NAND is NOT-AND, NOR is NOT-OR and XOR outputs 1 when inputs differ.
A truth table lists every possible input combination—2ⁿ rows for n inputs—and the output of each intermediate gate. To analyse a circuit, label intermediate outputs and evaluate one gate at a time. To draw one, translate brackets and operation order from the logic expression.
| A | B | AND | OR | XOR |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
QUICK CHAPTER SUMMARY
The ideas to carry forward
- Fields form records and keys preserve identity and relationships.
- Validation enforces rules but does not guarantee truth.
- SQL clauses select, filter and order data.
- Truth tables make every Boolean input combination explicit.
QUICK REVISION CHECKLIST
Can you do each of these without your notes?
- describe fields, records, data types and primary keys
- explain validation and relational database advantages
- write SELECT queries with filtering and ordering
- construct truth tables and logic circuits