Тёмный

Uber's SQL Question & Answer | Crack ANY Interview with this 3 Step Approach 

Jovian
Подписаться 56 тыс.
Просмотров 1,6 тыс.
50% 1

Опубликовано:

 

28 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 4   
@ManojKumar-ez2lb
@ManojKumar-ez2lb 6 месяцев назад
Hmmm i think you read it correctly but the implementation of the query was wrong. Check this out. SELECT yearmonth, ROUND(ABS(AVG(dpd-madp)),2) AS aadv FROM (SELECT TO_CHAR(request_date, 'mm-yyyy') AS yearmonth, distance_to_travel/monetary_cost AS dpd, SUM(distance_to_travel) OVER(PARTITION BY TO_CHAR(request_date, 'mm-yyyy')) / SUM(monetary_cost) OVER(PARTITION BY TO_CHAR(request_date, 'mm-yyyy')) AS madp FROM uber_request_logs ) T1 GROUP BY yearmonth
@ilyboc
@ilyboc Год назад
the first AVG averages over the group and the second one over the partition but why don't they return the same result. What is AVG(...) OVER (PARTITION BY DATE_FORMAT(...)) ?
@Siddharth_Matada
@Siddharth_Matada Год назад
you didnt explain the third paragraph in the problem clearly...wrt dataset like success and failure requests, also what if requests dates are not unique as they specifically mentioned in problem like 'assume all dates are unique'....
@jovianhq
@jovianhq Год назад
As the output column wanted specifically only YYYY-MM & the average distance difference - we've moved right into it. WRT request_status, they've asked us to consider both success & failure and if you run the request_status column, you'll notice that they're the only entries so nothing to filter. WRT assuming dates are unique, they've already asked us to assume they're unique so there's no need to check but if you want to check, you can do it by COUNT(request_date) & COUNT(DISTINCT request_date), you will get the same count. Hope this gives some clarity :)
Далее
Data Scientist Interview - Uber | AB Testing + SQL
48:15
ДУБАЙСКАЯ ШОКОЛАДКА 🍫
00:55
Просмотров 2,5 млн
Practice SQL Interview Query | Big 4 Interview Question
14:47
Uber Data Scientist Product Interview
15:08
Просмотров 6 тыс.