Question: SQL Step 2 Now, select the 2 tables with a join so that you can see each person's name next to their hobby. CREATE TABLE

SQL Step 2

Now, select the 2 tables with a join so that you can see each person's name next to their hobby.

CREATE TABLE persons ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER); INSERT INTO persons (name, age) VALUES ("Bobby McBobbyFace", 12); INSERT INTO persons (name, age) VALUES ("Lucy BoBucie", 25); INSERT INTO persons (name, age) VALUES ("Banana FoFanna", 14); INSERT INTO persons (name, age) VALUES ("Shish Kabob", 20); INSERT INTO persons (name, age) VALUES ("Fluffy Sparkles", 8);

CREATE table hobbies ( id INTEGER PRIMARY KEY AUTOINCREMENT, person_id INTEGER, name TEXT); INSERT INTO hobbies (person_id, name) VALUES (1, "drawing"); INSERT INTO hobbies (person_id, name) VALUES (1, "coding"); INSERT INTO hobbies (person_id, name) VALUES (2, "dancing"); INSERT INTO hobbies (person_id, name) VALUES (2, "coding"); INSERT INTO hobbies (person_id, name) VALUES (3, "skating"); INSERT INTO hobbies (person_id, name) VALUES (3, "rowing"); INSERT INTO hobbies (person_id, name) VALUES (3, "drawing"); INSERT INTO hobbies (person_id, name) VALUES (4, "coding"); INSERT INTO hobbies (person_id, name) VALUES (4, "dilly-dallying"); INSERT INTO hobbies (person_id, name) VALUES (4, "meowing");

insert into persons (name, age) values ('Pipa', 25); insert into hobbies (person_id, name) values (5, 'Hamada');

select persons.name, hobbies.name from persons, hobbies;

select persons.name, hobbies.name from persons join hobbies on persons.id = hobbies.person_id;

SELECT persons.name, hobbies.name as hobby FROM hobbies JOIN persons on persons.id = hobbies.person_id;

I've done the first step but I need the correct code for the second step?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!