CSC 282 · Database Programming
Our notes
2 min readCreating a file
- Design the record layout (fields, types, sizes, key).
- Create the empty file (or table) with that structure.
- Load the first records, validating each.
The four operations (CRUD)
| Operation | File view | SQL |
|---|---|---|
| Create (insert) | add a record | INSERT |
| Read (retrieve) | find and display | SELECT |
| Update | change fields of a record | UPDATE |
| Delete | remove a record | DELETE |
Insertion
- Sequential file: insertions are sorted and merged during the next master update.
- Direct file: compute the address, place the record (handle collisions).
- Always check the key does not already exist.
Updating
Find the record by key, change the fields, write it back. Record who changed it and when for important data.
Two kinds of update:
- Amendment: change details (a new phone number).
- Posting: apply a transaction to a balance (a ₦20,000 fee payment reduces the amount owed).
Deletion
- Logical delete: mark the record (a "deleted" flag) and skip it; it can be restored, and history is kept. dBase marked records with DELETE and removed them only on PACK.
- Physical delete: remove it from storage. Space is reclaimed, the record is gone.
Business systems often prefer logical deletion or archiving for audit.
Validation checks before storing
- Presence: required fields not empty.
- Type: digits where digits are expected.
- Range: score 0 to 100; level 100 to 600.
- Format: matric number pattern, e-mail shape.
- Length: phone number 11 digits in the 0803... form.
- Lookup: the course code exists in the course file.
- Check digit: a digit computed from the others catches typing errors (used in ISBNs and account numbers).
Validation checks that data is reasonable; verification checks it was entered as the source says (double entry, reading back).
Worked example: posting payments
Master: student 1001 owes ₦85,000; 1002 owes ₦40,000. Transactions: 1001 pays ₦50,000; 1003 pays ₦10,000.
- 1001 becomes ₦35,000.
- 1002 unchanged.
- 1003 has no master record: write it to an error report, do not create a new student from a payment.
Exams usually ask
- Explain CRUD and give the matching SQL.
- Logical versus physical deletion.
- Name and give examples of validation checks; distinguish validation from verification.
Common mistake
Updating or deleting without first confirming the record exists and is the right one. In SQL, an UPDATE with no WHERE clause changes every row.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Best pick Create, read, update and delete
(opens en.wikipedia.org in a new tab)
Wikipedia, Create, read, update and delete, CC BY-SA 4.0 · licence
-
Flat-file database
(opens en.wikipedia.org in a new tab)
Wikipedia, Flat-file database, CC BY-SA 4.0 · licence
-
NOUN CIT 304: Data Management
NOUN course book (PDF, about 6.9 MB: best on Wi-Fi). Files, databases, the relational model and SQL.
(opens nou.edu.ng in a new tab)
-
NOUN CIT 213: Elementary Data Processing
NOUN course book (PDF, about 0.9 MB). Fields, records, files and processing data.
(opens nou.edu.ng in a new tab)
-
OpenStax, Workplace Software and Skills (whole free textbook)
The whole book, free to read online or download as a PDF (the PDF is large: Wi-Fi).
(opens openstax.org in a new tab)
OpenStax, OpenStax, Workplace Software and Skills (whole free textbook), CC BY-NC-SA 4.0 · licence
Watch
-
Files Handling in Python | Create, Update, Delete, Rename etc.
12 min · ≈ 54 MB · about ₦30
(opens youtube.com in a new tab)
-
SQL Data Manipulation: INSERT, UPDATE, DELETE Explained - SQL Tutorial for Beginners
26 min · ≈ 117 MB · about ₦66
(opens youtube.com in a new tab)
-
4. Basic SQL Commands - SELECT, INSERT, UPDATE, DELETE (CRUD Operations Explained)
7 min · ≈ 32 MB · about ₦18
(opens youtube.com in a new tab)
-
SQL Query Basics: Insert, Select, Update, and Delete
11 min · ≈ 50 MB · about ₦28
(opens youtube.com in a new tab)
-
Databases - Unit 4 Lecture/Demo - MySQL Insert, Update, Delete, Primary/Foreign Keys - Fall 2025
54 min · ≈ 243 MB · about ₦136
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.