1--update query example
2 UPDATE table_name
3 SET column1 = value1, column2 = value2, ...
4 WHERE condition;
1UPDATE employees
2SET
3 address = '1300 Carter St',
4 city = 'San Jose',
5 postalcode = 95125,
6 region = 'CA'
7WHERE
8 employeeID = 3;
9
1Mit UPATE werden Datenwerte in der Datenbank aktualisiert. Nach Bedürfnis
2können auch mehrere Datensätze auf einmal verändert werden. Mit WHERE werden
3nur bestimmte Datensätze zu aktualisiert.
4
5 UPDATE suppliers
6 SET supplier_id = 50,
7 supplier_name = 'Apple',
8 city = 'Cupertino'
9 WHERE
10 supplier_name = 'Google';
11
1Updates existing data in a table.
2Example: Updates the mileage and serviceDue values for a vehicle with an
3id of 45 in the cars table.
4UPDATE cars
5SET mileage = 23500, serviceDue = 0
6WHERE id = 45;
1/*Swap f to m and m to f*/
2UPDATE salary
3SET
4 sex = CASE sex
5 WHEN 'm' THEN 'f'
6 ELSE 'm'
7 END;
1UPDATE computer SET cores = {}, cpu_speed = {}, ram = {}, cost = {} WHERE name = '{}'
2