Distinct on multiple fields
Marketing wants to understand customer purchase frequency by looking at unique customer-date combinations. This will help them spot patterns in buying behavior across different time periods.
Use the AI assistant to generate a query that shows distinct customer-date pairs.
This exercise is part of the course
Introduction to SQL with AI
Exercise instructions
- Give the AI a clear instruction to return each unique combination of customer ids and order dates.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
SELECT customer_id
FROM orders;