Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQL CODING QUESTION: THERE ARE TWO TABLES IN THIS PROJECT, each with the common column of vendorid. the table names are: SALES, and VENDOR the

SQL CODING QUESTION:

THERE ARE TWO TABLES IN THIS PROJECT, each with the common column of vendorid.

the table names are: SALES, and VENDOR

the columns of the SALES table are as follow: STORE, UPC, WEEK, MOVE, QTY, PRICE, SALE, PROFIT, OK, YEAR, VENDORID

the columns of the VENDOR table are as follows: VENDORID, NAME, ADDRESS, STATE, UPC, BALANCE, CREATEDATE, CLOSEDATE

THIS ARE THE QUERIES I NEED, I KNOW THEY ARE RELATIVELY SIMPLE AND BUILD OFF EACH OTHER. THANKS SO MUCH IN ADVANCE

Query 4: Return the vendor id, vendor name, product UPC code, move, and sales (price * move/qty) for each product sold by store 100 in 1995. Sort by sales descending. N.B since year is a reserved word in SQL, you will need to surround the field year in quotes in order for it to work.

Query 5: Return the total sales (this is not a column in either table) (price*move/qty) for each product. The output should have the UPC of a product and the total sales of that product. Call the new field totalSales.

Query 6: Return only the total sales (this is not a column in either table) (price*move/qty) for each product that exceed $40,000. Again, the output should have the UPC of a product, the total sales of that product and have the calculated field renamed as totalSales.

Query 7: For each vendor return the total sales of their products at each store between the years 1992 and 1995 (inclusive). Sort by total sales descending. The output should have the vendor name, store number, and total sales (renamed as totalSales).

Query 8: For each store and product, return the totalSales, total gross profit (both of which are not columns in either table) (totalGP = price*move/qty*profit/100), count of weekly sales records, and average move amount of the product at that store. Only show data for vendors with a name > 'H'. Sort by gross profit descending. The output should have the store number, product UPC, total sales, total gross profit, count of records, and average move volume (renamed averageMove).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions