Topic: Sales and Client Analysis
Allow me to use a virtual dataset called Dior. From the Dior dataset, I would like to calculate the total number of female adult customers in the time period 6-7pm in the Orchard outlet, and the average number of male adult customers across 3 time periods (10-11am, 1-2pm, 5-6pm) in the  MBS outlet.  I want these results in a separate table. Save these results into a CSV file called 'dior_seg.csv'. Do this in a single postgreSQL query.

Topic: Sales and Client Analysis
You have a sales table with the following columns: customer_id, week, date, basket_key, sales, units. Write some SQL code that can, for every product in every week, classify customers as "new" or "existing" depending on whether they had purchased that product in the previous 6 weeks.