Hey guys,
I'm having some problems with SQL. Im currently working in ProgresQL.
I have two tables with the following columns:
table case_data_order (
id numeric, -- An id for a single purchase
create_timestamp timestamp, -- The timestamp of when the purchase was made, in CET
cid numeric, -- An id for the customer who made the purchase
purchase_amount bigint, -- The amount of the purchase, in cents
currency text, -- The currency of the purchase
birth_year timestamp, -- The birth year of the customer, NULL for company purchases
gender text, -- The gender of the customer, none for company purchases
merchant_id bigint, -- An id for the merchant the purchase was made at
country text, -- The country of the customer
device text -- The device the purchase was made with, NULL if not known
table case_data_merchant (
merchant_id bigint, -- An id for the merchant, can be used to connect to orders
merchant_group text, -- The group of the merchant belongs to, is the Mechant Segment together with merchant_category
merchant_category text -- The category the merchant belongs to, is the Mechant Segment together with merchant_group
These are the questions I still haven't been able to answer. Ive been trying a lot of commands, but would greatly appreciate if someone could help me out with these remaining questions.
Which merchant, with more than 10 000 sales during 2014, had the best growth in quantity of transactions between the years 2014-2015?
In wich segment was the merchant who had the highest quantity of sales during 2015?
Which segment, with more than 1 000 000 transactions, had the highest share of female purchasers?
Which merchant, in the segment (merchant_group) Entertainment and with more than 10 000 sales during 2014, had the highest quantity of sales during 2015?
During which time interval, counted as a whole hour (13:00-13:59), occurred the highest number of purchases for the age group 18-25 during 2015 on a Tablet in the segment (merchant_group) Entertainment?
Best Regards
Pixxco