For this assignment, use MySQL. Print out your interaction with the DBMS. 1.Crea
ID: 3712027 • Letter: F
Question
For this assignment, use MySQL. Print out your interaction with the DBMS.
1.Create a database with the following tables (relations):
supplier (SupplierNo, SupplierName, City):
<S1, Smith, Laramie>
<S2, Jones, Chicago>
<S3, Blake, Chicago>
<S4, Clark, Boston>
<S5, Adams, Boston>
item (ItemNo, ItemName):
<I1, Nut>
<I2, Bolt>
<I3, Cog>
<I4, Cam>
supplied (SupplierNo, ItemNo, Quantity):
<S1, I1, 400>
<S1, I2, 300>
<S1, I3, 500>
<S2, I1, 100>
<S2, I2, 200>
<S3, I3, 300>
<S4, I1, 100>
<S4, I3, 100>
Explanation / Answer
Answer:
Create DATABASE Suppliers; /*This command will create the DATABASE*/
CREATE TABLE supplier
(
SupplierNo int NOT NULL,
SupplierName varchar(50),
City varchar(15),
PRIMARY KEY (SupplierNo)
); /*This query will create the supplier Table*/
Output:
Table(s) Created
Create TABLE item
(
ItemNo int NOT NULL,
ItemName varchar(20)
);/*This query will create the item Table*/
Output:
Table(s) created.
Create TABLE supplied
(
SupplierNo int NOT NULL,
ItemNo int Not NULL,
Quanitity int,
FOREIGN KEY (SupplierNo)
REFERENCES supplier(SupplierNo)
FOREIGN KEY (ItemNo)
REFERENCES item(ItemNo)
);/*This query will create the supplied table*/
Output:
Table(s) created.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.