6. Deleting a record

In the example so far, we have three records

sql example 2

One of the basic requirements of a database is to be able to delete a record

The sql command to do this is

DELETE FROM clubs WHERE ClubID = 1

The DELETE FROM is qualified with a table name

DELETE FROM clubs

followed by a WHERE clause to limit the number of records to be deleted

DELETE FROM clubs WHERE ClubID = 1

 

In this case a single record is to be deleted from the clubs table whose primary key is 1.

The WHERE clause can be more general than this in order to select a specific set of records.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: SQL DELETE command

 

 

 

Copyright © www.teach-ict.com