[n/a] "Save" Button won't run program

,

I’m working on the “Create a Table” project in SQL in the Data Science path. I can’t seem to run the program, every time I press “Save” it saves the program but never runs it. Am I missing something? I saw a couple people post about a bug similar to this, saying they just refresh every time they want to run it, but even that workaround doesn’t work for me. In the attached screenshot I tried writing bogus to break it just to see if it would throw an error, but it doesn’t work regardless of what I put in.

Thanks in advance :slight_smile:

Hello @babacher and welcome to the forums :grinning:

Can you provide link to this exercise so I can try to replicate the bug?

For now I will move this to the bug report category.

1 Like

Here’s the link, thanks for helping out!

1 Like

SO far I am not able to recreate the bug.
Have you tried refreshing the page, and running the code again?

I have tried refreshing, and it doesn’t seem to work. It does save the code, but doesn’t run it. I took a video of the issue, but since I’m a new user I’m unable to upload it. I tried it on Firefox as well as Chrome, and another computer, and get the same issue, I’m very confused. It could be something very basic that I’m not doing since I’m a newb, but if so I’m completely puzzled.

I’m sorry I missed this.

Have you been running line 1 every time?

Breakk the program test

Try taking it away and see if the code runs correctly.

I know you used it as a test, but I think it may be messing the program up.
When I run the code with it I get the same display as you, but the code works well without it.

Using bogus code should still throw an error though…

Yeah, the code without line 1 still doesn’t run for me, I only threw it in there trying to force an error after it initially wouldn’t run with the clean code.

So just pressing save or command enter (for mac) should run the program in normal circumstances, no? If so, seems to be an error unique to my account, since I tried it on different browsers and machines.

I have been using a Chrome book to experiment.
The code itself should run when you click save.
Perhaps it is unique to your account, though it could also be unique to me, I will ask a moderator to take a look.

However it is not throwing an error when I enter bad code, which I believe it should be doing.

Hello @babacher. Have you tried putting single quotation marks(' ') around your dates:

'1930-05-30'

Even if this doesn’t work, this is good practise to enclose dates, strings, etc in single quotation marks.

Hi there.

I don’t know whether it’s a feature of the LE not relaying any errors from SQLite, but I’ve spent a bit of time trying to re-create your issue.

If I write something in the SQL query to force SQLite into an error, the entire query is halted at the point of the error as one would expect.

In your case, even if I remove your opening line of “Breakk the program test”, your SQL query looks like:

CREATE TABLE friends (
  id INTEGER,
  name TEXT,
  birthday DATE,
);

INSERT INTO friends (id, name, birthday)
VALUES (1, "Jane Doe", 1990-05-30);

INSERT INTO friends (id, name, birthday)
VALUES (2, "Jack", 1995-02-15);

INSERT INTO friends (id, name, birthday)
VALUES (3, "Grayson", 1996-06-15);

SELECT * FROM friends;

The cause of your error is the trailing comma at the end of your table declaration.

If we look at the syntax diagram for the CREATE TABLE statement in SQLite, which I have reproduced from their documentation pages here, we can see the following:

I have highlighted the appropriate section with orange; this is the column_def section.

In the syntax diagram, you can see how the flow arrows only go to the comma after a column definition (like id INTEGER for instance) when we are gearing up to declare another column.

If I remove that trailing comma from your SQL, the LE runs your query fine:

Can you please re-try the query without that trailing comma? It ought to run fine after that. :slight_smile:

Edit: To be sure, I spun up a REPL to check that I’m not talking nonsense. If I try and run the query with the trailing comma in the CREATE TABLE expression on line 1, I get this:

image

:slight_smile:

1 Like

Thanks @thepitycoder! I don’t think we ever showed errors our SQL project because our SQL workspace don’t have a user-facing terminal and we don’t have tests for projects (we only have tests for lessons).

I think the learner is supposed to type SELECT * FROM friends; throughout the program to figure out what’s wrong with the code.

But this is great feedback though, I’m about to author more SQL content so this is good to know. And great answer to the learner, too!

2 Likes

You were dead on! Removed the trailing comma, and it runs perfectly. Thanks for the thorough responses all, I really appreciate it. Sonny, I wrote SELECT * FROM friends; at the end of my program but I was used to seeing error messages from the little Python I’ve dabbled in, even if there were no tests. Thanks again everyone!

3 Likes

I’ve not done any of the SQL courses, other than any odd pieces where someone’s asked about it on the forums. My assumptions about the LE are based on how I’ve seen it work for the other languages I’ve done here (like Python, Go, etc…).

At least I now know that no result = SQLite error somewhere. Should be handy if this crops up again. :slight_smile:

:+1: Glad we could help. :slight_smile:

1 Like