Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Show transcribed image text Expert Answer Was this answer helpful? 0 0 10 answer

ID: 3916388 • Letter: S

Question

Show transcribed image text

Expert Answer

Was this answer helpful?

0

0

10 answers

Use the "Create table" command first to define the tables. And use "Insert into" to insert entries in the tables.

CREATE TABLE Suppliers (
   SupplierNo CHAR(2) PRIMARY KEY,
   Name VARCHAR(255),
   Status INT,
   City VARCHAR(255)
);

CREATE TABLE Parts (
   PartNo CHAR(2) PRIMARY KEY,
   Name VARCHAR(255),
   Color VARCHAR(255),
   Weight INT,
   City VARCHAR(255)
);

CREATE TABLE Projects (
   ProjectNo INT PRIMARY KEY,
   Name VARCHAR(255),
   City VARCHAR(255)
);

CREATE TABLE Shippments (
   SupplierNo CHAR(2) PRIMARY KEY,
   PartNo CHAR(2) PRIMARY KEY,
   ProjectNo INT PRIMARY KEY,
   Quantity INT  
);

INSERT INTO Suppliers VALUES ('S1', 'SMITH', 20, 'LONDON');

Insert all the entries required using the "Insert into" command.

Explanation / Answer

If you have any doubts, please give me comment...

1)

ALTER TABLE Shipments ADD ShipDate DATE, ADD ArriveDate DATE;

2)

SELECT ROUND(DATEDIFF(ArriveDate, ShipDate), 0) AS AVG_NUMBER_OF_DAYS

FROM Shipments;

3)

SELECT ProjectNo, COUNT(*)

FROM Shipments

WHERE YEAR(ArriveDate) = 2017

GROUP BY ProjectNo;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote