You are currently viewing SQL UPDATE, DELETE Statements 

SQL UPDATE, DELETE Statements 

UPDATE Statement

Update statement is used to update records which are already in the database table

In this lesson we are working with the course table which includes the following fields

(couseID, CoursTitle, Duration)

As an example we are going to update the highlighted duration 6Months to 12Months

Using following SQL query we can update the duration of the course computer basics 6Months to 12Months

UPDATE course SET Duration = '12Months'
WHERE courseID = '1'

The updated table will appear as follows

DELETE Statement

SQL Delete statement is using to delete records in a database table

As an example we are going to delete Computer Network row which is course_ID = 2

Using following SQL query we can delete the Computer Network row

DELETE FROM course WHERE courseID = '2'

The updated table will be shown as follows

Leave a Reply