This is regarding SQL or databases. Here I have 2 queries to create 2 tables (part and
Question:
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
CoursHeroTranscribedTextModern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi