Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedThis 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

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

Step: 3

blur-text-image

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions