Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is regarding SQL or databases. Here I have 2 queries to create 2 tables (part and product). The idea is that a product may

This is regarding SQL or databases.

Here I have 2 queries to create 2 tables (part and product). The idea is that a product may require multiple parts and that it might require more than 1 of a part.

Here are the Queries:

Create Table Part ( Part_id int NOT NULL AUTO_INCREMENT, PartType Varchar(50), PartAmountAvailable int, PartDescription VARCHAR(50), CONSTRAINT Part_id_PK PRIMARY KEY (Part_id) );

Create Table Product ( Product_id int NOT NULL AUTO_INCREMENT, Part_id int, AmountOfPartsNeeded int, ProductType varchar (50), ProductDescription VARCHAR (50), CONSTRAINT Product_id_PK PRIMARY KEY (Product_id), CONSTRAINT Part_id_FK FOREIGN KEY (Part_id) REFERENCES Part(Part_id) );

I'd like to figure out a few things, first of all how do I make more or less Part_id to different Product entities, as in how do i give more or less Part_id to a product.

The second thing I'd like to figure out is how would I link the products and the parts so that certain products may need more than one of a part.

Thanks a bunch.

Here are the queries in picture form

image
CoursHeroTranscribedText

00 1 2 3 4 5 6 CONSTRAINT Part_id_PK PRIMARY KEY (Part_id) 7 9 10 11 12 13 34 14 FRO Create Table Part ( Part_id int NOT NULL AUTO_INCREMENT, PartType Varchar(50), 15 16 17 18 PartAmountAvailable int, PartDescription VARCHAR(50), ); Limit to 1000 rows Create Table Product ( Product_id int NOT NULL AUTO_INCREMENT, Part_id int, AmountOfParts Needed int, Product Type varchar (50), Product Description VARCHAR (50), CONSTRAINT Product_id_PK PRIMARY KEY (Product_id), CONSTRAINT Part_id_FK FOREIGN KEY (Part_id) REFERENCES Part (Part_id) );

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

Why might Pine Valley Furniture Company need a data warehouse?

Answered: 1 week ago