UPDATE Statements

UPDATE statements are used to amend data currently in the database

An UPDATE statement will have 3 main parts

  1. Specify the table that has the information to be updated

  2. What the new values are going to be

  3. The criteria for which records to update

Update Query - Single Field, Single Value

A few of the bikes for the BMX Intro course are being repaired and the new capacity for the course will be 8. We will update the record to show 8 for the capacity.

UPDATE Query Design

SQL Statement Example

Update Query - Multiple records

There has been an issue with the training facility and all courses that are due to run on the 10th of December have had to be changed to the 11th of December.

UPDATE Query Design

SQL Statement Example

When searching for text values you must use ‘speech marks’

You can use logical conditions such as AND, OR and NOT to create more complex queries

Update Query - Multiple fields

There has been a change of staffing and all of the ‘BMX Intro’ courses will now be taught by another instructor (ID 3) and will be limited to a capacity of 10.

UPDATE Query Design

SQL Statement Example

SQL Tutorial 2 UPDATE Statements

5 SQL UPDATE.mp4

This video will cover how to use an UPDATE statement to change existing rows within a table