Computers and Technology
Computers and Technology, 28.06.2021 20:10, zionboy77

My tables are: customer(cid, name, city, state)
orders(oid, cid, date)
product(pid, productname, price)
lineitem(lid, pid, oid, number, totalprice)
I want to create a view ProductMonth (PID, ProductName, Month, QuantitySold, NumberCus­tomer, Revenue) that gives for each the product and each month, the quantity sold, the number of distinct customers who bought the product and amount of money the sale corresponds to for the month.
I used extract() to get the months from orders. date. I need to know how to loop each month and each product. I couldn't come up with a working query. Is it even possible to do it in MySQL? I mean looping the product name for each month and calculating the total price and also how much each product sales contributed to the whole. I know how to implement this for a particular product or month but not for products sold in each month. I tried using joins but it fails. I need the query and also a logic to implement it.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:30, chaparro0512
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
image
Computers and Technology, 22.06.2019 20:00, bartlettcs9817
Which location-sharing service offers items for users as a gaming component and also allows them to collectively link their check-ins to publish a trip? a. whrrl b. buzzd c. foursquare (this option is wrong i already tried) d. gowalla for plato
Answers: 2
image
Computers and Technology, 23.06.2019 14:30, kodak0531
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
image
Computers and Technology, 24.06.2019 12:30, nomood
Select all that apply. what two keys listed below should you use to enter data in an excel worksheet? tab backspace enter right arrow
Answers: 2
Do you know the correct answer?
My tables are: customer(cid, name, city, state)
orders(oid, cid, date)
product(pid, pro...

Questions in other subjects:

Konu
Mathematics, 05.01.2021 17:40
Konu
English, 05.01.2021 17:40