Applying SQL to Real-World Problems
Dmitriy (Dima) Gorenshteyn
Lead Data Scientist, Memorial Sloan Kettering Cancer Center
UPDATE table_name
SET column1 = value1, column2 = value2, ...;
Desired Update: Emails of customers must be lowercase.
UPDATE customer
SET email = LOWER(email);
Desired Update: Emails of customers must be lowercase for customers who are still active.
UPDATE customer
SET email = LOWER(email)
WHERE active = TRUE;
Desired Update: Emails of customers must be lowercase for customers reside in city of Woodridge.
UPDATE customer
SET email = LOWER(email)
WHERE address_id IN
(SELECT address_id
FROM address
WHERE city = 'Woodridge');
SELECT
statement first.Applying SQL to Real-World Problems