SQL Project: query results window goes blank upon incorrect statement - unable to recover

Twice now, at step 6 of Learn SQL | Codecademy, when I execute an incorrect statement, the SQL query results window goes blank and I’m unable to recover.

Below is the code of my second go round (I hit the reset after the first instance) The issue occurs when I execute the line update table friends name = 'storm' where id = 1;. the lines after that are my attempt to recover, but the query results window remains blank. Although I the line is out of order from the instructions, I wouldn’t think that would be an issue in this case.

create table friends (

  id integer,

  name text,

  birthday date


insert into friends (id, name, birthday)

values (1, 'Ororo Munroe', '1940-05-30');

select * from friends;

insert into friends (id, name, birthday) values

(2, 'James Taylor', '1940-06-12'),

(3, 'Mark Dodd', '1960-03-05');

select * from friends;

alter table friends add email text;

update table friends name = 'storm' where id = 1;

update table friends set name = 'storm' where id = 1;

select * from friends;

Unfortunately you don’t get much of a warning when there’s a problem in the SQL lessons, if any statement causes an error the entire thing goes blank. THis means that further queries won’t make any difference, a single error blanks all of the results (regardless of whether it’s on the first line or the last line).

If you didn’t know where it was I’d suggest commenting out sections of your code with either -- for single lines or the /* */ for multiple lines but it sounds like you’ve found the troublesome line. Double check the syntax is valid.

Thanks. Confirmed what I suspected and experienced as I tested it more by copying my code to an external editor, hitting the reset project link and then copying back and executing statements one at a time. Clumsy, but at least I’m not having to start from scratch each time I have to hit reset. Makes me really scared to make a mistake. I finally realized that I had the key word ‘TABLE’ in my UPDATE statement and that was the cause of the problem.

1 Like

Aye I remember running query by query when starting out or even just commenting out every previous query so as to keep the results clear. That and testing complex queries bit by bit so I’d not be caught out by syntax mistakes. It’s harsh but it does make you double check everything before running it :slightly_smiling_face:.

Hi, I’m really not sure where the best place for this question is, but I just downloaded Postgres + Postbird and I just can’t see why I’m getting a syntax error with creating a table. I wrote this query as a test and still: Any help please??!

create table testing (
  author varchar(20) primary key,
  person int(5)

Hello @kertesz41 ,

Try not specifying the length for datatype of integer for the person column.

1 Like