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, 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 5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started