UPDATE changes existing records:
UPDATE table SET column1 = value1, column2 = value2 WHERE condition;
WHERE clause, every row in the table is updated.Change existing rows.
✍️ 3 exercises + code challenge in this lessonUPDATE changes existing records:
UPDATE table SET column1 = value1, column2 = value2 WHERE condition;
WHERE clause, every row in the table is updated.Mastering SQL UPDATE helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
UPDATE Products
SET Price = Price * 0.9
WHERE Category = 'Furniture';
UPDATE Customers
SET Email = 'usman@electronics.pk', City = 'Rawalpindi'
WHERE CustomerID = 3;
SELECT ProductName, Price FROM Products WHERE Category = 'Furniture';
SELECT * FROM Customers WHERE CustomerID = 3;
Check what you learned in “SQL UPDATE”.
Change the city of customer 7.
Customers City = 'Sialkot' WHERE CustomerID = 7;
What happens if you run UPDATE without WHERE?
Set the Stock of the Bookshelf (ProductID 9) to 5, then select ProductName, Stock for ProductID 9.
Free sign-in required · Google login available
Stuck on something?
Ask the community in the CodesInTech forum.
Need a developer?
Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.
Explore Our Services