A
A
al_paccha2021-11-28 04:06:50
SQL
al_paccha, 2021-11-28 04:06:50

Sampling of people who bought a product on a specific date sql?

You have 3 tables:
users - users
purchases - purchases
skus - products Use
these tables to output the answers to the questions:
How many people bought the product with sku.id = 5 on October 10?
The query result must return a single digit.
How many people from Moscow bought phones in September and October?
The query result must return a format table.
month
people
september
n
october
m

n, m – number of people who bought phones in integer format.

Important to remember:
Not all people in the users table have made purchases.
In the users and purchases tables, the data is only for 2021.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
al_paccha, 2021-11-28
@al_paccha

SELECT COUNT(user_id) FROM purchases
WHERE user_id > 0 AND sku_id = 5 AND created_at = “10-10-2021”
this should seem to work for 1 question, but from 2 even xs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question