INSERT INTO, UPDATE and DELETE, then storing data in text and CSV files: open, read, write, append and close.
INSERT, UPDATE and DELETE
INSERT INTO Film (FilmID, Title, Genre, Year, Minutes)
VALUES (8, 'Iron Harbour', 'Action', 2023, 112)
UPDATE Film
SET Minutes = Minutes + 5
WHERE Genre = 'Musical'
DELETE FROM Film
WHERE Year < 2005
- INSERT INTO adds one new record: one value for each field listed, in the same order, with text in quotes.
- UPDATE changes the fields named after SET, in every record that meets WHERE.
- DELETE FROM removes every record that meets WHERE.
Leave out WHERE and UPDATE changes every record, and DELETE empties the whole table.
Practise: INSERT, UPDATE and DELETE on Brainlag Code.
The rest of this lesson and its 18 practice questions are in Plus.
Screen 1 of 3, free to read.
- 18 exam-style questions, marked as you go, each with a worked solution
- Anything you get wrong is saved to your flashcards