So I have a crowdfunding platform and I want to create a YoY active backers growth chart…
Jump to turn (7)
- 1So I have a crowdfunding platform and I want to create a YoY active backers grow
- 2Can you rewrite it using TO\CHAR on the date?
- 3Perfect. Is there a way of writing it using the quarter, instead of the year?
- 4Perfect. What If I want to make a YTD backers query?
- 5What if I want to do a YTD but grouped by week of the year?
- 6Perfect. What if I want to show on the same chart the YTD of the previous year,
- 7Perfect. What if I wanted to know only the growth YTD. Which means that instead
- User
So I have a crowdfunding platform and I want to create a YoY active backers growth chart to analysse. I have a table called 'allpayments' where I can see the 'user_id' of the backer, the 'created_at' of the payment and the 'state' of the payment (that should be paid to be considered a valid payment). How should I write this SQL?
- Assistant
To create a Year-over-Year (YoY) active backers growth chart, you can use the following SQL query:
codeSELECT EXTRACT(YEAR FROM created_at) AS year, COUNT(DISTINCT user_id) AS active_backers FROM allpayments WHERE state = 'paid' GROUP BY yearThis query will extract the year from the
created_atfield for each payment, count the number of distinct values (i.e., active backers) for each year, and group the results by year.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.