UPDATE users SET id = 5, name = 'Arif' WHERE id = 0;
# here users = table name,
# id, name it's two column
UPDATE Customers
SET first_name = 'Johnny'
WHERE customer_id = 1;
UPDATE table_name SET column1=value1, column2=value2 WHERE condition
UPDATE employees SET name = 'Jack' WHERE name = 'Jackson';
UPDATE `table_name`
SET `status` = 'offline'
WHERE `id` = 2386;
UPDATE `table_name` SET `column1` = value1, `column2` = value2 WHERE condition;
//to update value
UPDATE students SET course_id = 102
WHERE last_name = 'Jones'; ->
if there is no condition it will update all!
UPDATE mytable t -- Update using WITH statement
SET value3 = (
WITH comp AS (
SELECT id, value1
FROM mytable t
WHERE value2 > 10
)
SELECT c.value1
FROM comp c
WHERE c.id = t.id
);
UPDATE table_name
SET column1 = value1, column2 = value2...., columnN = valueN
WHERE [condition];
Mit UPATE werden Datenwerte in der Datenbank aktualisiert. Nach Bedürfnis
können auch mehrere Datensätze auf einmal verändert werden. Mit WHERE
werden nur bestimmte Datensätze zu aktualisiert.
UPDATE suppliers
SET supplier_id = 50,
supplier_name = 'Apple',
city = 'Cupertino'
WHERE
supplier_name = 'Google';
UPDATE table_name
SET column_name1 = value1, column_name2 = value2
WHERE condition;
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
UPDATE 'table'
SET a = 0, b = 1, ... , b = n
WHERE x = y;