Загрузка...

SQL Interview Question | Intersect and Having | Amazon

Lst the IDs of customers who made at least 3 orders in both 2020 and 2021.
Step-by-step:
First SELECT: Finds users with 3+ orders in 2020.
Second SELECT: Finds users with 3+ orders in 2021.
INTERSECT: Returns only those users who appear in both lists — meaning they consistently ordered 3 or more times in both years.

It’s a great use of INTERSECT to find repeat behavior across time periods.

Dataset here:
https://github.com/Gaelim/youtube/blob/master/orders_data.csv
Contact me on LinkedIn:
https://www.linkedin.com/in/gaelimholland/

Видео SQL Interview Question | Intersect and Having | Amazon канала Absent Data
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки