UPDATE Command in SQL

Last Updated: January 2026


The UPDATE command is used to modify existing records in a table.

  • Updates one or more columns
  • Can affect one row, many rows, or all rows
  • WHERE clause is critical

Hinglish Tip 🗣: Existing data ko change karna hoUPDATE.


🧾 Basic UPDATE Syntax

UPDATE table_name
SET column1 = value1,
    column2 = value2;

Warning: ⚠️ Without WHERE, all rows will be updated.


📄 Example: Update All Rows (Dangerous)

UPDATE employees
SET status = 'Active';

✅ Safe UPDATE (With WHERE)

UPDATE employees
SET salary = 60000
WHERE emp_id = 101;

✔ Updates only one employee


🔄 Update Multiple Columns

UPDATE employees
SET salary = 65000,
    designation = 'Senior Dev'
WHERE emp_id = 102;

🔄 UPDATE Using Another Table

UPDATE employees e
SET salary = salary * 1.1
FROM departments d
WHERE e.dept_id = d.dept_id
AND d.dept_name = 'IT';