ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Leetcode HARD 262 - Trips and Users JOINs CASE WHEN GROUP SQL - Explained by Everyday Data Science

data science

data analysis

data science interview prep

LeetCode solutions

everyday data science

data science portfolio projects

data structures and algorithms

sql window function

data enegineering

sql tutorial

solved answers

learn sql fast

how to learn sql

practice sql questions

step by step solution

data analytics

best sql video

window function

joins in sql

leetcode 262

learn to earn

sql interview

dsa

leetcode hard

trips and users

Автор: Everyday Data Science

Загружено: 2024-08-09

Просмотров: 985

Описание: Question: https://leetcode.com/problems/trips-a...

SQL Schema:
Create table If Not Exists Trips (id int, client_id int, driver_id int, city_id int, status ENUM('completed', 'cancelled_by_driver', 'cancelled_by_client'), request_at varchar(50))
Create table If Not Exists Users (users_id int, banned varchar(50), role ENUM('client', 'driver', 'partner'))
Truncate table Trips
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('1', '1', '10', '1', 'completed', '2013-10-01')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('2', '2', '11', '1', 'cancelled_by_driver', '2013-10-01')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('3', '3', '12', '6', 'completed', '2013-10-01')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('4', '4', '13', '6', 'cancelled_by_client', '2013-10-01')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('5', '1', '10', '1', 'completed', '2013-10-02')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('6', '2', '11', '6', 'completed', '2013-10-02')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('7', '3', '12', '6', 'completed', '2013-10-02')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('8', '2', '12', '12', 'completed', '2013-10-03')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('9', '3', '10', '12', 'completed', '2013-10-03')
insert into Trips (id, client_id, driver_id, city_id, status, request_at) values ('10', '4', '13', '12', 'cancelled_by_driver', '2013-10-03')
Truncate table Users
insert into Users (users_id, banned, role) values ('1', 'No', 'client')
insert into Users (users_id, banned, role) values ('2', 'Yes', 'client')
insert into Users (users_id, banned, role) values ('3', 'No', 'client')
insert into Users (users_id, banned, role) values ('4', 'No', 'client')
insert into Users (users_id, banned, role) values ('10', 'No', 'driver')
insert into Users (users_id, banned, role) values ('11', 'No', 'driver')
insert into Users (users_id, banned, role) values ('12', 'No', 'driver')
insert into Users (users_id, banned, role) values ('13', 'No', 'driver')

Pandas Schema:
data = [['1', '1', '10', '1', 'completed', '2013-10-01'], ['2', '2', '11', '1', 'cancelled_by_driver', '2013-10-01'], ['3', '3', '12', '6', 'completed', '2013-10-01'], ['4', '4', '13', '6', 'cancelled_by_client', '2013-10-01'], ['5', '1', '10', '1', 'completed', '2013-10-02'], ['6', '2', '11', '6', 'completed', '2013-10-02'], ['7', '3', '12', '6', 'completed', '2013-10-02'], ['8', '2', '12', '12', 'completed', '2013-10-03'], ['9', '3', '10', '12', 'completed', '2013-10-03'], ['10', '4', '13', '12', 'cancelled_by_driver', '2013-10-03']]
trips = pd.DataFrame(data, columns=['id', 'client_id', 'driver_id', 'city_id', 'status', 'request_at']).astype({'id':'Int64', 'client_id':'Int64', 'driver_id':'Int64', 'city_id':'Int64', 'status':'object', 'request_at':'object'})

data = [['1', 'No', 'client'], ['2', 'Yes', 'client'], ['3', 'No', 'client'], ['4', 'No', 'client'], ['10', 'No', 'driver'], ['11', 'No', 'driver'], ['12', 'No', 'driver'], ['13', 'No', 'driver']]
users = pd.DataFrame(data, columns=['users_id', 'banned', 'role']).astype({'users_id':'Int64', 'banned':'object', 'role':'object'})

#leetcodesolutions #datascience #sql

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Leetcode HARD 262 - Trips and Users JOINs CASE WHEN GROUP SQL - Explained by Everyday Data Science

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Leetcode HARD 579 - Cumulative Salary of Employee RANGE vs ROW BETWEEN in SQL - Explained by EDS

Leetcode HARD 579 - Cumulative Salary of Employee RANGE vs ROW BETWEEN in SQL - Explained by EDS

Как устроена База Данных? Кластеры, индексы, схемы, ограничения

Как устроена База Данных? Кластеры, индексы, схемы, ограничения

🔴АУСЛЕНДЕР: Техника для Украины УНИЧТОЖЕНА! ДИВЕРСИЯ В НАТО!

🔴АУСЛЕНДЕР: Техника для Украины УНИЧТОЖЕНА! ДИВЕРСИЯ В НАТО!

Что такое SAGA за 10 минут

Что такое SAGA за 10 минут

⚡️Банковский кризис в России. Путин в Минске. СВОшников обманули. | Жуковский, Троицкий | ВОЗДУХ

⚡️Банковский кризис в России. Путин в Минске. СВОшников обманули. | Жуковский, Троицкий | ВОЗДУХ

Итоги дня | Роскошная свадьба Кадырова | Киркоров против репрессий | Задержан главный патриот

Итоги дня | Роскошная свадьба Кадырова | Киркоров против репрессий | Задержан главный патриот

Все JOIN в SQL Для Начинающих За 15 Минут

Все JOIN в SQL Для Начинающих За 15 Минут

ПОТАПЕНКО:

ПОТАПЕНКО: "Я скажу страшную вещь". Про экономику, Силуанова, пакет с пакетами и ЧТО ДАЛЬШЕ

LeetCode 262 - Trips & Users (Python and SQL) [Hard]

LeetCode 262 - Trips & Users (Python and SQL) [Hard]

LeetCode 262: Trips and Users [SQL]

LeetCode 262: Trips and Users [SQL]

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]