[Solved] Quering Tables Project 2/7

"Smooth Criminal" is a track from Michael Jackson's "Bad" album. Add this track to the database.

I have no idea how to do this. Do I use INSERT INTO?


I used

INSERT INTO tracks (id, title, album_id) VALUES (1, 'Smooth Criminal', 1);

I used the same, when I hit Save nothing returns, not sure if I am doing this right?

Hi

return to the how you have created the table:
CREATE TABLE tracks (id INTEGER PRIMARY KEY, title TEXT, album_ID INTEGER);

it means that when you add new data into the table no need to Insert ID number in the table because it will be populated automatically (Primary key);
INSERT INTO tracks (name) VALUES (‘Smooth Criminal’);

should be ok In my opinion

not having luck with this one so far but still working on it

Hi,

basically you need to link the track with the album_id so that when you join the two tables the both end up having the right match otherwise it will not work.

INSERT INTO tracks (id, title, album_id)
VALUES (1, ‘Smooth Criminal’, 8);

try this.

1 Like