3. Daily Revenue


#1

"Fields like refunded_at will only have data if the transaction was refunded, and otherwise left null."

But

"Complete the query by filtering for refunded_at is not null."

We should filter using IS NULL. It means that there wasn't any refund. If "refunded_at" field contains a date there was a refund.


#2

I have the same question!


#3

exactly, it must be "IS NULL". I reported it too.


#4

Just here to also leave the same comment, the instructions are giving us the refunded amounts, not the revenue with refunds excluded. Thought I was going crazy for a second there!


#5

use this

select
date(created_at),
round(sum(price), 2) as daily_rev
from purchases
where refunded_at is not null
group by 1
order by 1;

in which the where statement says " where is not null "


#6

So happy you wrote here, I was starting to question my basic logic!


#7

IT must be IS NULL. If it IS NULL then there was no refund therefore that field should be included in overall profit.


#8

I had the same thought myself. Glad to see I'm not alone. Part of coding is understanding the logic of how to word something, and it doesn't help when the example is wrong!


#9