create table test (city text, country text, size_rank numeric)
insert into
test (city, country, size_rank)
values
('Tokyo', 'Japan', 1),
('Delhi', 'India', 2),
('Shanghai', 'China', 3),
('São Paulo', 'Brazil', 4),
('Mexico City', 'Mexico', 5)
alter table
test
add
column population numeric
alter table
test rename column population to city_pop
alter table
test
alter column
city_pop type int
update
test
set
city = 'Ciudad de México'
where
city = 'Mexico City'
alter table
test rename to world_cities
alter table
world_cities drop column city_pop
delete from
world_cities
where
city = 'Tokyo'
drop table world_cities