LearnStanmorephysics

Grade 12 · Matric Mastery

INSERT, UPDATE & DELETE

Grade 12 · Databases & SQL · SQL lab · about 18 minutes

Open this task in the Delphi workspace →

Action queries change the data instead of asking about it — so in Delphi they run with ExecSQL, never Open.

INSERT INTO tblLearners (LearnerID, FirstName, …)
VALUES (13, 'Enzokuhle', …)

UPDATE tblLearners
SET ClassCode = 'B'
WHERE LearnerID = 3

DELETE FROM tblLearners
WHERE ITMark < 50

Two survival rules:

  • The VALUES must match the field list one for one, in order — quotes on text, none on numbers.
  • An UPDATE or DELETE without a WHERE hits every row in the table. In an exam that is marks gone; in real life it is a career highlight you do not want. Always write the WHERE first.

After each Run the DBGrid shows the table's new state, and the row count tells you exactly what your query touched.

About this material

This platform provides original CAPS-aligned practice material and study tools. Content is machine-verified and has not been reviewed by subject specialists. It is not affiliated with or endorsed by the Department of Basic Education. Learners should also use official past papers and consult their teachers where uncertain.