FAQ: Manipulation - Insert

This community-built FAQ covers the “Insert” exercise from the lesson “Manipulation”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development
Data Science

Learn SQL

FAQs on the exercise Insert

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I’m a rookie and I’m stuck. I created the celebs table (I think). On the right, it says:
### Query Results
Run a query to see results.

### Database Schema
celebs0 rows
id INTEGER
name TEXT
age INTEGER

Nothing seems to happen when I attempt to insert rows. I’ve quadruple-checked that I’m following the syntax exactly. No () or ; is out of place. But every time I select “Run” it still just says exactly what i pasted above: celebs 0 rows.

What am I missing? It’s too early in this course to be this stumped. :slight_smile:

maybe the UI doesn’t update? Just run an select statement at the end of your code to be sure:

select * from celebs;

This exercise doesn’t work for me, either, and I have years of SQL experience. When I do a select *, it shows 4 identical rows having been inserted. Running the second section of the exercise adds 4 copies of each row.

this also doesn’t work for me. Did anyone find a fix?

Works for me.

SELECT * FROM celebs;

It is good to verify the the above code that the arguements were correctly inserted.

Hi all,
I might be getting ahead of the game, but I was playing around and added an new record to the table with text in the age column (‘INF’). This was both accepted and displayed when checking with the
“SELECT * FROM celebs;” command.

INSERT INTO celebs (id, name, age)
VALUES (4, 'Kermit the Frog', 'INF');

I had assumed the age column was originally defined as an INTEGER (based on the previous page) and that I would receive some kind of error.
As this didn’t happen, can anyone what has happening in this situation?
Would the data_type for column age in the table celebs have been changed from INTEGER to TEXT, or was it TEXT already?

Thanks in advance!
Glyn

1 Like

Any idea why this error occured?

you didn’t properly enclose your string on line 5, you can see the colors changes from that point onward.

2 Likes

What is going on here why is it not working its identical to the solution

I keep running the query but the results section remains empty. Any ideas as to why?

Not sure if you get to see anything when you do an insert, maybe add a SELECT statement to see the newly inserted rows?

1 Like

First, click on the reset button. After the first task, add the statement in your editor and for the 2nd task add the three statements below it without omitting the first one.

Maybe, it’s too late to answer your question (because you may have already figured it out). Anyways, I was pulling my hear looking at the same screen you’re. However, earlier in this FAQs @stetim94 suggested that we run a select statement like this: SELECT * FROM celebs; and your screen should show like the one the screenshot below.

3 Likes

Is there a way to select, modify/update, delete multiple rows or columns?
Like SELECT id & name? DELETE name+age?

There seems to be some issue with the environment - random letters I type seem to be disappearing and queries just don’t work.

I’m not getting any type of error when I try to run the command, but it won’t complete. When I do it for the first INSERT for Justin Bieber it moves along and asks for 3 more rows. I do those and then hit run and nothing happens. Below is what I have. I’ve tried this way and all uppercase for the commands. I’ve tried spaced like this and no spaces between the inserts as well

insert into celebs (id, name, age)
values (1, ‘Justin Bieber’, 22);

insert into celebs (id, name, age)
values (2, ‘Beyonce Knowles’, 33);

insert into celebs (id, name, age)
values (3, ‘Jeremy Lin’, 26);

insert into celebs (id, name, age)
values (4, ‘Taylor Swift’, 26);

1 Like

HI, can someone explain the use of semicolons in this example.

the semi colon is just to show that the program is completed, thats END

I think i have learnt from this.