Misc MySQL UPDATE Examples

UPDATE - Single row

Update a single row of data.

START TRANSACTION
GO

UPDATE students
SET    
       customer_id_fk                = '23099-56'  ,
       marital_status_code           = 'M'  ,
       fin_alert_code                = '3'  
WHERE  student_id = 11  
GO

COMMIT 
GO

UPDATE - Update multiple rows

Update multiple rows of data..

START TRANSACTION
GO

UPDATE employeesaffiliates
SET    relationship_type_code        = '1'  ,
       employee_inactivating         = 0 
WHERE  person_id is not null 
GO

COMMIT 
GO

 Collapse All    Expand All
Custom Search

MySQL Information and Resources