CSC 283 · Information Systems and File Structures
Our notes
2 min readFrom bits to databases
| Level | What it is | Example |
|---|---|---|
| Bit | a binary digit, 0 or 1 | 1 |
| Byte | 8 bits; holds one character in ASCII | 01000001 = "A" |
| Field (data item) | one or more bytes holding one fact | matric number, surname |
| Record | a group of related fields about one entity | one student's details |
| File | a collection of records of the same kind | the student file |
| Database | a set of related files (tables) with links | students, courses, results |
A word is the number of bits a processor handles at once (16, 32 or 64).
Entities and attributes
An entity is a thing we keep data about (student, book, account). Its attributes become fields. Each actual occurrence (one student) becomes one record.
Keys
- Primary key: a field (or fields) that identifies each record uniquely: matric number, account number.
- Secondary key: a field used to search or sort, not unique: department, surname.
- Composite key: two or more fields together: (matric number, course code) in a results file.
- Foreign key: a field that refers to the primary key of another file: course code in the results file points to the course file.
Never use a field that can change or repeat (name, phone number) as the primary key.
Worked example: building a record
A student record:
| Field | Type | Size (bytes) |
|---|---|---|
| Matric number | characters | 12 |
| Surname | characters | 20 |
| Other names | characters | 30 |
| Department code | characters | 4 |
| Level | integer | 2 |
| CGPA | real | 4 |
Record length = 12 + 20 + 30 + 4 + 2 + 4 = 72 bytes.
For 25,000 students the file needs 25,000 × 72 = 1,800,000 bytes, about 1.72 MB (1,800,000 ÷ 1,048,576), before any blocking or index overhead.
Logical and physical views
- Logical: how users and programs see the data (records with named fields).
- Physical: how it is actually laid out on the device (blocks, tracks, sectors, pointers).
Keeping the two apart (data independence) lets the storage change without rewriting programs.
Exams usually ask
- Arrange and define the levels of the data hierarchy.
- Define primary, secondary and composite keys with examples.
- Calculate a record length and file size.
Common mistake
Confusing a field with a record. A field is one fact (surname); a record is all the facts about one entity (the whole student).
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
No reading links here yet
Our team adds free books, videos and practice for each topic, and opens every link before it goes up.