6.3 CRUD: Create, Read, Update, and Delete

6.12

create table test (city text, country text, size_rank numeric)

6.13

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)

6.14

alter table
    test
add
    column population numeric

6.15

alter table
    test rename column population to city_pop

6.16

alter table
    test
alter column
    city_pop type int

6.17

update
    test
set
    city = 'Ciudad de México'
where
    city = 'Mexico City'

6.18

alter table
    test rename to world_cities

6.19

alter table
    world_cities drop column city_pop

6.20

delete from
    world_cities
where
    city = 'Tokyo'

6.21

drop table world_cities