Domesticated Brain

UPDATE Statement

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

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

(couseID, CoursTitle, Duration)

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

SQL Tutorials UPDATE Statement Course Table

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

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

The updated table will appear as follows

SQL Tutorials UPDATE Statement Result

DELETE Statement

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

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

SQL Tutorials DELETE Statement Course Table

Using following SQL query we can exclude a row of date

DELETE FROM course WHERE courseID = '2'

The updated table will be shown as follows

SQL Tutorials UPDATE Statement Result

 

If you have found  what you expected please comment and like on our facebook page