Code is too picky on formatting


#1

In a number of the exercises, I write the code, and go to run and get an error. After a few attempts, I hit the "Get Code" button, and it gives me the same exact code I wrote, just formatted different.

Example: For one, I wrote
with daily_revenue as (select date(created_at) as dt, round_sum(price), 2) as rev
from purchases
where refunded_at is null
group by 1)
select *
from daily_revenue
order by dt;

This would give an error: Error: near line 1: near "as": syntax error.
Moving the "select" keyword down a line does nothing and produces the same error. Hitting Get Code gives me the following:

with daily_revenue as (
select
date(created_at) as dt,
round(sum(price), 2) as rev
from purchases
where refunded_at is null
group by 1
)
select * from daily_revenue order by dt;

There is no difference in the code, aside from how it is formatted. It really makes this course difficult to complete or even get into.


#2

I'm having the same issue. I've resorted to "Get Code" and working backwards. Certainly not ideal, but what's finally accepted is identical to what I had.

OP: I noticed you have round_sum(price), 2) as rev - does it make a difference if you change it to round(sum(price), 2) as rev?


#3

hmm, the example I used would have a typo, go figure. So I guess this one's on me, but in other ones it's been exactly the same. I just happened to copy a bad example.


#4

This is so true, and it is frustrating the learning process fr me.

I have to keep coming on here to see if I'm forgetting a space, not indenting, or incorrectly capitalizing something - or if it's truly something wrong with my code.

I wish someone would review this entire course & correct it; I didn't have this issue with the introductory SQL track, nor the command line I did today.