UNIHIVE

Study Hub UNIPORT CSC 283

CSC 283 · Information Systems and File Structures

The data hierarchy

Bits, bytes, fields, records, files and databases, and how each level is built from the one below.

Our notes

2 min read

From bits to databases

LevelWhat it isExample
Bita binary digit, 0 or 11
Byte8 bits; holds one character in ASCII01000001 = "A"
Field (data item)one or more bytes holding one factmatric number, surname
Recorda group of related fields about one entityone student's details
Filea collection of records of the same kindthe student file
Databasea set of related files (tables) with linksstudents, 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:

FieldTypeSize (bytes)
Matric numbercharacters12
Surnamecharacters20
Other namescharacters30
Department codecharacters4
Levelinteger2
CGPAreal4

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.

All CSC 283 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.