Computer Science · A3.3 Database Programming

A3.3.3 — Updating Data with SQL: INSERT, UPDATE, DELETE

Preview

IB DP Computer Science — A3 Databases — Database programming | SL | A3.3.3

📋 What You Will Learn

  • Construct INSERT INTO statements to add new records
  • Construct UPDATE … SET statements to modify existing data safely
  • Construct DELETE statements and respect referential integrity when removing data
  • Explain why the WHERE clause is critical in UPDATE and DELETE
  • Explain the performance implications of modifying data in indexed columns, and why indexes may need rebuilding after large changes

✏️ Why This Matters A database that can only be read is a museum. Real systems change constantly — a student joins, a grade is corrected, a leaver's records are removed. The three write statements of DML do this work, and because they change permanent data, precision (especially in the WHERE clause) matters far more than in a SELECT.

The Working Schema

As in A3.3.2: Student(studentID PK, firstName, lastName, yearLevel, house) and Enrolment(enrolmentID

Continue reading the full note