SQL – Update

An UPDATE statement is used to change the values of an already existing record.

Be very careful with this, because this command updates anything that matches the “WHERE” criteria. If you can, try and use the Primary key 

 

 

 

 

 

For example, we want to UPDATE a rating “PG” to ‘Parental Guidance’:

UPDATE 

Films 

SET Rating = “Parental Guidance”

WHERE Rating = “PG”;

 

UPDATE 

Films 

SET Rating = “Parental Guidance” (This is what the data has to change to) 

WHERE Rating = “PG”; (This is the data that has to change) 

Original Data

 

 

 

 

 

 

 

 

 

 

Changed Data