![]() |
VOOZH | about |
The UPDATE query in SQL is used to modify existing records in a table. It allows you to update specific columns' values in one or more rows of a table. It's important to note that the UPDATE query affects only the data, not the structure of the table.
UPDATE tablename
SET column1 = "new_value", column2 = "new_value"
WHERE condition;
DATABASE IN USE:
👁 python-mysql-updateIn this example, we'll update the age of a student named "Rishi Kumar" in the STUDENT table. We will change his age to 23:
Output:
Explanation:
In this example, we will correct the spelling of the student's name from "SK Anirban" to "S.K. Anirban" in the STUDENT table:
Output:
👁 python-mysql-update2Explanation: