Computer Studies Revision Notes

Databases & File Organization: Records, Keys, SQL & Access Methods

Understand data hierarchy (bit to database), sequential, indexed-sequential and random file organization, relational keys, and basic SQL queries.

1. Data Hierarchy & Database Fundamentals

Data in a computer system is organized from smallest unit to largest: | Level | Meaning | School Example | | :--- | :--- | :--- | | Bit / Byte (Character) | Smallest binary digit (0/1) or single character (A, 7) | S | | Field (Attribute) | Single data item (column) in a table | AdmissionNo, FullName | | Record (Tuple) | Complete set of related fields for one entity (row) | ("SV-104", "Ada Obi", "SS3") | | File / Table (Relation) | Collection of related records of the same structure | STUDENTS table | | Database | Organized collection of related tables managed by a DBMS | School academic database | A Primary Key uniquely identifies each record (StudentID), while a Foreign Key links a child table back to a Primary Key in a parent table to enforce referential integrity.

2. File Organization & Access Methods

How records are stored on disk determines retrieval speed and batch efficiency: | File Organization | How Records Are Stored | Best Use Case & Limitation | | :--- | :--- | :--- | | Serial | Unordered, one after another as they arrive | Transaction logs; slow to search | | Sequential | Sorted in order by a key field (e.g. StudentID) | Payroll & monthly billing; must read from start | | Indexed-Sequential (ISAM) | Sorted records paired with a fast lookup index | Supports both batch runs and fast direct lookup | | Direct / Random (Hashed) | Hash function maps key directly to disk address | Real-time banking ATMs & airline reservations |

3. Core SQL Operations & Examiner Traps

Structured Query Language (SQL) retrieves and updates relational data: - SELECT FullName, Score FROM Results WHERE Score >= 70 ORDER BY Score DESC; — filters and sorts matching rows. - INSERT INTO Students (...) VALUES (...); — adds a new record. - UPDATE modifies existing rows; DELETE removes rows. Examiner Trap: Always include a WHERE clause in UPDATE or DELETE statements—omitting WHERE updates or deletes every row in the table! Also distinguish a Primary Key (unique and never NULL within its own table) from a Foreign Key (can repeat across child rows to represent one-to-many relationships).