• 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 Vehicle rental

Conceptual design

(2)

Logical design

Primary keys are underlined.

CarRental (ArrId, DepId, VId, CId, RTId, paymentMode, #rental, #kilometers, revenue)

LOCATION (LId, city, province, region) VEHICLE (VId, model, type, brand) OPTIONS (OId, name)

VEHICLEOPTIONS (VId, OId)

RENTALTIME (RTId, date, month, monthOfYear, 2m, 3m, 6m, year, dayOfWeek, workingDay)

CLIENTPROFILE (CId, clientType, clientProvince, clientRegion)

Queries Query A

Consider the rentals payed with credit card. Separately for each month, client type, province of the client’s domicile, analyze: the average number of kilometers for rental, the cumulative number of kilometers from the beginning of the year, the average daily kilometers.

SELECT

clienttype, clientprovince, month, year, sum(#kilometers)/sum(#rentals),

sum(sum(#kilometers) over (partition by clienttype, clientprovince, year

order by month

rows unbounded preceding) sum(#kilometers)/count(distinct date)

FROM

carrental cr, rentaltime rt, clientprofile cp WHERE

cr.rtid = rt.rtid and cr.cid = cp.cid and paymentmode=’credit card’

GROUP BY

clienttype, clientprovince, month, year

(3)

Query B

Consider the rentals of “truck” vehicle type. Separately for each rental start month and for each departure province, analyze: the average revenue per kilometer, the percentage of revenue over the total revenue of the year, the percentage of revenue over the total revenue for the corresponding departure region

SELECT

month, year, d.province, d.region, sum(revenue)/sum(#kilometers),

100*sum(revenue)/sum(sum(revenue)) over (partition by year,

d.province) 100*sum(revenue)/sum(sum(revenue)) over (partition by month, d.region)

FROM

carrental cr, rentaltime rt, location d, vehicle v WHERE

cr.rtid = rt.rtid and cr.arrlid = d.lid and cr.vid = v.vid and v.type=’truck’

GROUP BY

month, year, d.province, d.region

Riferimenti

Documenti correlati

The degree graph of a finite group G, that we denote by ∆(G), is defined as the (simple undirected) prime graph related to the set cd(G) of the irreducible complex character degrees

For every layer the algorithm determines the best species tree structure, by comparing the number of crossing in the default conguration with the number of crossings after

Government Printing Office , Social Security Administration (US)..

Au total, les saints laïcs médiévaux originaires de Venise et vénérés dans cette ville sont peu nombreux – 5 au maximum avec Anna Michiel Giustiniani dont

In this section we fix some notations and we recall some known facts about the solutions of the obstacle problem, their blow-up limits, the decomposition of the free boundary in

Proprio a causa dei dubbi interpretativi che circondano questo articolo il legislatore ha cercato di porre fine alle incertezze con la recente legge n. 128 del 2019,

A discrete random measure, used to generate a species sam- pling model, can either have a countable infinite number of atoms, which has been the emphasis in the recent literature, or