Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NSWER THE FOLLOWING QUERIES, with output and the query itself Create the following table: CREATE TABLE PRODUCT_INFORMATION ( PRODUCT_ID INT PRIMARY KEY, PRODUCT_NAME VARCHAR(50), PRODUCT_CATEGORY

NSWER THE FOLLOWING QUERIES, with output and the query itself

Create the following table:
CREATE TABLE PRODUCT_INFORMATION (
PRODUCT_ID INT PRIMARY KEY,
PRODUCT_NAME VARCHAR(50),
PRODUCT_CATEGORY VARCHAR(50),
PRODUCT_MANUFACTURER VARCHAR(50),
PRODUCT_COLOR VARCHAR(20),
PRODUCT_MATERIAL VARCHAR(20),
PRODUCT_WEIGHT FLOAT,
PRODUCT_LENGTH FLOAT,
PRODUCT_WIDTH FLOAT,
PRODUCT_HEIGHT FLOAT,
PRODUCT_PRICE FLOAT,
PRODUCT_RATING FLOAT,
PRODUCT_SOLD_DATE DATE,
SALES_PERSON VARCHAR(50),

PRODUCT_DESCRIPTION VARCHAR(200)
);

INSERT INTO PRODUCT_INFORMATION VALUES (1, 'Product A', 'Category 1', 'Manufacturer 1',
'Red', 'Metal', 1.5, 10.0, 5.0, 3.0, 10.99, 4.2, TO_DATE('2022-01-05', 'YYYY-MM-DD'), 'Salesperson 1',
'This is a description of Product A.');
INSERT INTO PRODUCT_INFORMATION VALUES (2, 'Product B', 'Category 2', 'Manufacturer 2',
'Blue', 'Plastic', 2.5, 20.0, 10.0, 5.0, 20.99, 3.8, TO_DATE('2022-02-10', 'YYYY-MM-DD'), 'Salesperson
2', 'This is a description of Product B.');
INSERT INTO PRODUCT_INFORMATION VALUES (3, 'Product C', 'Category 1', 'Manufacturer 3',
'Green', 'Wood', 1.0, 5.0, 5.0, 2.0, 15.99, 4.5, TO_DATE('2022-03-15', 'YYYY-MM-DD'), 'Salesperson 1',
'This is a description of Product C.');
INSERT INTO PRODUCT_INFORMATION VALUES (4, 'Product D', 'Category 3', 'Manufacturer 1',
'Yellow', 'Metal', 3.0, 15.0, 5.0, 5.0, 30.99, 4.0, TO_DATE('2022-04-20', 'YYYY-MM-DD'), 'Salesperson
3', 'This is a description of Product D.');
INSERT INTO PRODUCT_INFORMATION VALUES (5, 'Product E', 'Category 2', 'Manufacturer 2',
'Purple', 'Plastic', 1.5, 10.0, 10.0, 3.0, 25.99, 4.8, TO_DATE('2022-05-25', 'YYYY-MM-DD'), 'Salesperson
2', 'This is a description of Product E.');
INSERT INTO PRODUCT_INFORMATION VALUES (6, 'Product F', 'Category 1', 'Manufacturer 3',
'Blue', 'Wood', 2.5, 10.0, 5.0, 4.0, 22.99, 3.5, TO_DATE('2022-06-30', 'YYYY-MM-DD'), 'Salesperson 1',
'This is a description of Product F.');

Answer the following Queries:
1. What is the average price of products in each category, but only for categories with more than 10
products?
2. What is the total price of products sold in each year and month, but only for months where the total
price is greater than $10,000?
3. What is the minimum price of products manufactured by each manufacturer and in each color, but
only for manufacturers and colors with more than 3 products?
4. What is the total price of products sold by each salesperson, in each category?
5. What is the total weight of products sold by each salesperson, in each category and material?
6. What is the total price of products sold by each salesperson, in each year and month, and in each
category?
7. What is the total price of products sold in each year, and in each category?
8. Find the total sales and average rating for each product category and salesperson:
9. Retrieve all products sold after January 1, 2022, ordered by their sold date in ascending order and
their price in descending order.
10. Retrieve all products in the Category 1, 2, or 3 and sold by Salesperson 1 or Salesperson 2, ordered
by their category in descending order, weight in ascending order, and price in descending order.

Step by Step Solution

3.35 Rating (167 Votes )

There are 3 Steps involved in it

Step: 1

Below are the SQL queries along with descriptions for each question Ill provide the queries and sample outputs will follow each query based on the data you provided 1 Average Price of Products in Each ... 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

Step: 3

blur-text-image

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 Systems Analysis And Design

Authors: Joseph Valacich, Joey George

8th Edition

0134204921, 978-0134204925

More Books

Students also viewed these Accounting questions

Question

What is regret ? (p. 2 49)

Answered: 1 week ago

Question

What is information systems analysis and design?

Answered: 1 week ago