Intern — Senior
94
Названия городов и их жители
被问到的公司:
Самокат Тех
任务条件
Получите список названий городов вместе с именами пользователей, проживающих в каждом из них.
-- Таблица "cities"
create table cities (
id serial primary key,
name text not null
);
insert into cities (name)
values
('Москва'),
('Санкт-Петербург'),
('Краснодар');
-- Таблица "users"
create table users (
id serial primary key,
name text not null,
city_id int not null references cities(id)
);
insert into users (name, city_id)
values
('Иван', 1),
('Анна', 1),
('Олег', 2);