Question: This is my code thus far: CREATE TABLE make ( id SERIAL, name VARCHAR(128) UNIQUE, PRIMARY KEY(id) ); CREATE TABLE model ( id SERIAL, name

This is my code thus far: CREATE TABLE make ( id SERIAL,This is my code thus far:

CREATE TABLE make ( id SERIAL, name VARCHAR(128) UNIQUE, PRIMARY KEY(id) );

CREATE TABLE model ( id SERIAL, name VARCHAR(128), make_id INTEGER REFERENCES make(id) ON DELETE CASCADE, PRIMARY KEY(id) );

insert into make(name) values ('GMC'); insert into make(name) values ('Hyundai');

insert into model(name, make_id) values ('Savana 1500/2500 2WD (passenger)', 1); insert into model(name, make_id) values ('Savana 1500/2500 AWD (cargo)', 1); insert into model(name, make_id) values ('Savana 1500/2500 XWD (Passenger)', 1); insert into model(name, make_id) values ('J-Car/Elantra', 2); insert into model(name, make_id) values ('Kona AWD', 2);

SELECT make.name, model.name FROM model JOIN make ON model.make_id = make.id ORDER BY make.name LIMIT 5;

I need help with the following: I am supposed to return Row 1 column 2 expected Savana 1500/2500 2WD (passenger) and instead I got J-Car/Elantra. What is wrong with my code and can I get an answer for that?

CREATE TABLE make ( id SERIAL, name VARCHAR(128) UNIQUE, PRIMARY KEY(id) ); CREATE TABLE model ( id SERIAL, name VARCHAR(128), make_Id INTEGER REFERENCES make(id) ON DELETE CASCADE, PRIMARY KEY(id) ;; Insert the following data into your database separating it appropriately into the make and model tables and setting the make_id foreign key to link each model to its corresponding make. To grade this assignment, the program will run a query like this on your database and look for the data above: SELECT make.name, model.name FROM model JOIN make on model.make_id = make.id ORDER BY make, name LIMIT 5

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!