• Non ci sono risultati.

Data Warehousing Politecnico di Torino

N/A
N/A
Protected

Academic year: 2021

Condividi "Data Warehousing Politecnico di Torino"

Copied!
3
0
0

Testo completo

(1)

Data Warehousing

Politecnico di Torino

Food delivery

Conceptual design

(2)

Logical design

Primary keys are underlined.

DELIVERIES (RId, NId, DId, paymentMethod, transport, timeSlot, revenue, #deliveries, #kilometers, time) Restaurant (RId, LId, orderType, name, categ1, categ2, ..., categ10)

Location (LId, city, province, region)

Date(DId, date, month, 2-months, trimester, 4-months, 6-months, year, workingDay) Neighborhood(NId, neighborhood, LId)

Alternative solution

DELIVERIES (RId, LId, DId, paymentMethod, transport, timeSlot, revenue, #deliveries, #kilometers, time) Restaurant (RId, LId, orderType, name, categ1, categ2, ..., categ10)

Location (LId, city, province, region, neighborhood,)

Date(DId, date, month, 2-months, trimester, 4-months, 6-months, year, workingDay)

Queries Query A

Consider the orders with type “Partner order”. Separately for mean of transport and trimester, analyze: the average delivery time, the average number of deliveries per time slot (the average number of deliveries made in an hour), assign a rank to the trimesters based on decreasing number of kilometers run on average in a minute, separately by mean of transport.

SELECT transport, trimester, SUM(#time)/SUM(#deliveries),

SUM(#deliveries)/COUNT(DISTINCT timeSlot)

RANK() OVER (ORDER BY SUM(#kilometers)/SUM(#time) DESC PARTITION BY transport)

FROM Time T, Deliveries D, Restaurant Rs WHERE d.rid = rs.rid and d.did = t.did

AND orderType=`Partner order' GROUP BY transport, trimester

(3)

Query B

Consider the restaurants which have “pizza” among the associated categories. Carry out the analysis separately for payment method, delivery city and month.

Analyze: the cumulative monthly revenue from the beginning of each trimester, the average

revenue per delivery, the percentage of revenue with respect to the total revenue considering all the payment methods

SELECT paymentM, dCity, month, trimester

SUM(SUM(revenue)) OVER(PARTITION BY trimester, paymentM, dCity ORDER BY month ROWS UNBOUNDED PRECEDING) SUM(revenue)/SUM(#deliveries)

100*SUM(revenue)/SUM(SUM(revenue)) OVER(PARTITION BY month, dCity)

FROM Time T, Deliveries D, Restaurant R, Location L

WHERE d.did = t.did and d.rid = rs.rid and d.lid = l.lid and r.pizza=true

GROUP BY month, trimester, paymentMethod, deliveryCity

Riferimenti

Documenti correlati

Among the proposed methods seem particularly effective retrieving images according to their similarity with respect to an image given as query (Query by Example) and to refine

Conversely, the pragmatic one is built around dialysis (the most expensive and frequent mode of renal replacement therapy) and pre-dialysis treatment, focusing attention on the

Our main interest is to compare a classical estimation method; namely Exact Maximum Likelihood Estimation (EMLE) with the Generalized Maximum Entropy (GME) approach for estimating

trimester, analyze: the average delivery time, the average number of deliveries per time slot (the average number of deliveries made in an hour), assign a rank to the trimesters

This paper provides further evidence suggesting that: i changes in firms’ borrowing tend to be more sensitive to changes in asset prices in those economies where firms leverage

Collana di quaderni di critica operativa che raccolgono gli studi dell’omonimo gruppo di ricerca che ha operato presso il Dipartimento di Progettazione dell’Architettura alla

SM Seifert, Scahaechter JL, Hershorin ER, Lipshultz SE (2011) Health 18. effects of energy drinks on children, adolescents, and young adults. Atrial fibrillation in healthy

An immediate application in quantum optics experiments with structured light can be the tuning of distinguishability between copropagating pho- tons or the controlled generation of