Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions