Skip to main content

Activity 2.6

1

UPDATE and DELETE Commands

Using the music CD collection database you created previously, practise using the SQL Update and Delete commands by:

Part 1: changing the title of a CD

Part 2: changing the year of release

Part 3: deleting a track for a particular CD

Part 4: deleting a CD and all of its tracks.

Part 1

UPDATE cd

SET cd_title = 'Joe Cocker Hits Vol 1', release_year = 1997

WHERE cd_no = 2;

Part 2

DELETE

FROM track

WHERE cd_no = 3 AND track_no = 4;

Part 3

DELETE

FROM track

WHERE cd_no = 4;

Part 4

DELETE

FROM cd

WHERE cd_no = 4;

Check your answer

Next: SAQ 2.1