The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Need to write the following SQL queries for the schema provided in the screenshot as well as the DDL in text file. This should be simple for any SQL programmer, I'm new to SQL and having trouble
all queries should be written in the form:
SELECTÂ
FROM
WHERE
GROUP BY
HAVING
1.Return the product names and inventory value of each product (price*inventory) ordered by descending inventory value.
CREATE DATABASE shipment;CREATE TABLE Customer (cid integer,cname varchar(30),address varchar(50),city varchar(30),state varchar(2),primary key (cid) ) ENGINE=InnoDB;CREATE TABLE Product (pid integer,pname varchar(30),price decimal(9,2),inventory integer,primary key (pid) ) ENGINE=InnoDB;CREATE TABLE Shipment (sid integer,cid integer,shipdate datetime,primary key (sid),foreign key (cid) REFERENCES Customer(cid)) ENGINE=InnoDB;CREATE TABLE ShippedProduct (sid integer,pid integer,amount integer,primary key (sid, pid),foreign key (sid) REFERENCES Shipment(sid),foreign key (pid) REFERENCES Product(pid)) ENGINE=InnoDB;INSERT INTO Customer VALUES (1,'Fred Smith','101 Evergreen Terrace','Springfield','IL');INSERT INTO Customer VALUES (2,'Joe Smithsonian','245 Straight Street','Iowa City','IA');INSERT INTO Customer VALUES (3,'Steve Stevenson','24 Michigan Ave.','Chicago','IL');INSERT INTO Customer VALUES (4,'Russell Johnson','1 Hollywood Drive','Hollywood','CA');
Attachments: