Skip to content

Latest commit

 

History

History

Customer Acquisition

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Customer Acquisition

Star Badge View Main Folder View Repositories View My Profile


🛠️ Problem Statement

This problem was appeared in Tiger Analytics Interview

Table Name : Sales

Column Name Type
order_date date
customer varchar
quantity_purchased int

order_date, customer is the primary key for this table.

Write a SQL query to find the count of new customers added in each Month.

Return the result table in any order.

The query result format is in the following example:

Input

Table Name: Sales

order_date customer qty
2021-01-01 C1 20
2021-01-01 C2 30
2021-02-01 C1 10
2021-02-01 C3 15
2021-03-01 C5 19
2021-03-01 C4 10
2021-04-01 C3 13
2021-04-01 C5 15
2021-04-01 C6 10
Output
order_month customer_acquisition_count
2021-Apr 1
2021-Feb 1
2021-Jan 2
2021-Mar 2