Am I misunderstanding the objective tasks?


#1

Hello,

I am currently trying to perform the tasks in "Create Table" after completing the "Learn SQL" course.
Task1: Create a table for friends. I input the following SQL:

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

Press save, and so far so good. My database Schema pops up on the right hand side.

If I now proceed to task 2: Add Jane Doe to your table I remove the previous query and enter this SQL:

INSERT INTO friends (id, name, birthday) VALUES (1, 'Jane Doe', '1993-05-19');

The save button just keeps spinning, without ever completing.

Am I supposed to just write SQL statement for SQL statement on the lines below and check off the tasks as I go without pressing "Save"?

Thank you in advance.


#2

When you see the spinner and it never stops, that usually means there is something wrong with the SQL that you've used.

Those two line that you have posted there work for me, so I don't think that is the problem. Reload/refresh your browser and try those two lines again.

You do have to press Save each time you add new code and wish to check to see if it is working. Once you are satisfied that you have accomplished each task then you check it off.

Putting SELECT * FROM friends; as the last line will show you everything in your database, that will help you decide if your command worked as you'd hoped.


#3

I have the same exact issue. I think the problem is with the birthday column. I have used DATE, datetime, and datetime NULL as possible input types and none are accepted. The code appears to be entered correctly. I just haven't tried 05/19/93 format yet. Hey code academy, everything is great on the site except you need to add clues just like you do on other exercises to ensure we are inputting everything correctly. My only gripe with your site.


#4

You should be able to use DATE and something like '1993-05-19', or you could use TEXT for this exercise.

If you copy/paste both of your lines here, I'll try them out.


#5

Also on this particular section, if you refresh, you have to start all the way over and recreate the DB schema if Step 2 fails. at least thats what i'm running into. Goes from defined after successfully completing step 1 to undefined if you " incorrectly " enter the SQL statement for Step 2 of INSERTing the values for Jane Doe and her Birthday. Here's my last attempt:

INSERT INTO friends, (name, birthday)
VALUES ('Jane Doe', '05/13/93')
SELECT * FROM friends;

Here's my second attempt:

INSERT INTO friends (name, birthday)
VALUES ('Jane Doe', '1993-19-05')

SELECT * FROM friends;

Whats wrong with the statement?

Schema:

     friends

id INTEGER
name TEXT
birthday DATE


#6

That almost works, it just has an unwanted comma and is missing the semicolon:

INSERT INTO friends (name, birthday)
    VALUES ('Jane Doe', '05/13/93');

Your second attempt is just missing the semicolon.


#7

I have tried every possible combination of the statements in IE, FF, and Chrome, none of them work. I also do not understand why I have to recreate the DB schema every time if I hit F5 and refresh the screen. I think there's an issue with this website. I am also performing the action behind a corp firewall but I cannot see how that's causing an issue


#8

Here is what my project_1.sql_lite file looks like for the second step:

CREATE TABLE friends (id INTEGER, name TEXT, birthday DATE);
INSERT INTO friends (id, name, birthday)
    VALUES (1, 'Jane Doe', '1993-19-05');
SELECT * FROM friends;

#9

Having the exact same issue.

Seems like the second step breaks the DB from step 1.


#10

Thanks for your reply, Albionsrefuge.

I have now found the time to continue with this excercise, but I still only get the spinner. I am fairly certain there are no problems with my SQL code (I tried it in a blank MS SQL database and it works without error):

Once again, Task 1:

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

I get success-message so I check task one.

Task2:
I remove my previous code and enter the following:

INSERT INTO friends (id, name, birthday) VALUES (1, 'Jane Doe', '1993-05-19');
SELECT * FROM friends;

Queue the eternal spinner...


#11

After some further testing I see that if I keep my previous statements with me all the way I can complete each excersise without the spinner (ofcourse, provided that my SQL code is fucntioning).

i.e:

CREATE TABLE statement
INSERT statement
INSERT statement
INSERT statement
INSERT statement
UPDATE statement
ALTER statement
Append next statement

And so on...

I do not know if this is the expected way to complete it, but it worked for me.


#12

For the project part of this course, yes, it is the expected way.


#13

Hi,

I have a slightly different issue but on the same exercise. I keep getting the wrong date coming up when I do the final select to look at the results of the rows entered…

INSERT INTO friends (id, name, birthday) VALUES (1, ‘Jane Doe’, ‘1993-05-19’);
SELECT * FROM friends;

shows a date of 1969. ??

I cant figure this out.

Thank you kindly.


#15