[Solved] Quering Tables Project 2/7


#1

"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);


#2

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


#3

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


#4

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


#5

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.


#6