Back

Structured Query Language (SQL) - adding, removing and amending data

Adding, deleting and updating data in a table
The INSERT INTO command is used to add data into a table. Here is an example of adding a new record to the Owners' table:

INSERT INTO tblOWNERS (ID, TITLE, Surname, Phone_no, Registration)
VALUES (5, "Mr", "Smith", "091123456", "1996-10-12")

Notice the use of quotation marks and the format that of the date.

The DELETE FROM command is used to delete a record (a row) from a table. Here is an example of removing a record from the Owners' table:

DELETE FROM tblOWNERS 
WHERE Surname = "Smith"

Notice the use of quotation marks and the format that of the date.

We can update individual pieces of information in a field using the UPDATE command. Here is an example:

UPDATE tblOwners
SET Phone_no="021888888"
WHERE Surname="Smith"

Back