UPDATE

SQL UPDATE Keyword

The UPDATE command is used to modify existing rows in a table. It allows you to change one or more column values for rows that match a specified condition.

Important: Be careful when using UPDATE without a WHERE clause — it will update all rows in the table.

Tutorials dojo strip

SQL UPDATE Syntax

UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

SQL UPDATE Single Row Example

This query updates the specialty of the doctor with doctor_id = 1.

UPDATE Doctors
SET specialty = 'Dermatology'
WHERE doctor_id = 1;

SQL UPDATE Multiple Rows Example

This query sets the gender of all patients with last name ‘Garcia’ to ‘Female’.

UPDATE Patients
SET gender = 'Female'
WHERE last_name = 'Garcia';

SQL UPDATE Labs

Tutorials dojo strip
Scroll to Top