Applying SQL to Real-World Problems
Dmitriy (Dima) Gorenshteyn
Lead Data Scientist, Memorial Sloan Kettering Cancer Center
Remove a table
DROP TABLE table_name;
Clear table of ALL records
TRUNCATE TABLE table_name;
Clear table of SOME records
DELETE FROM table_name WHERE condition;
Desired Modification: Remove customers who are no longer active
DELETE FROM customer
WHERE active = FALSE;
Desired Modification: Removing all customers who live in the city of Woodridge.
DELETE FROM customer
WHERE address_id IN
(SELECT address_id
FROM address
WHERE city = 'Woodridge');
Applying SQL to Real-World Problems