• Non ci sono risultati.

Data warehouse design (PC store)

N/A
N/A
Protected

Academic year: 2021

Condividi "Data warehouse design (PC store)"

Copied!
3
0
0

Testo completo

(1)
(2)

Data warehouse design (PC store)

Assembling(​timeIdA​, ​componentId​, #components, cost, delivery_cost) TimeAss(​timeIdA​, m, 2m, 4m, 6m, year)

Component(​componentId​, code, component_type, memory_capacity*, type*, access_time*, resolution*, supplName, supplier_region, supplier_area)

Sales(​confId​, ​retId​, ​timeIdS​, production_cost, selling_price, #PC_sold, #defective_PC_returned) Configuration(​confId​, RAM_code, HD_code, CPU_code, graphicBoard_Code, RAM_supplier, HD_supplier, CPU_supplier, graphicBoard_supplier) (or *_code as ids)

Supplier(​suppId​, nameS) Retailer(​retId​, nameR, #shops) TimeSales(​timeIdS​, m, 2m, 3m, year)

d) Considering only 2002, for each configuration whose RAM has been bought from the

“IntelligenceDevice” supplier, select the percentage of defective products with respect to the total number of sold products.

SELECT year, SUM(#defective_PC_returned)*100/SUM(PC_sold) FROM TimeSales t, Sales S, Configuration C, Supplier CS

WHERE t.timeIdS=S.timeIdS AND C.RAM_supplier = S.suppId AND C.confId=S.confId AND year='2002' AND CS.nameS=“IntelligenceDevice”

GROUP BY confId;

e) Considering only 2007 and RAM components, for each four-month period select the total cost (component cost + delivery cost) and the cumulative cost since the beginning of the year,

separately for each geographical area and RAM type

SELECT 4-M, component_type, supplier_area, SUM(cost)+SUM(delivery_cost),

SUM(SUM(cost)) OVER ( PARTITION BY component_type, supplier_area, year ORDER BY 4-m ROWS UNBOUNDED PRECEDING DESC )

FROM TimeAss t, Assembling A, Component C

WHERE t.timeIdA=A.timeIdA AND C.componentId=A.componentId AND year = '2007' AND component_type='RAM'

GROUP BY 4-M, year, component_type, supplier_area;

(3)

h) Considering only suppliers from which, in 2003, more than 100 000 components have been bought in total, select for each supplier and each component type the number of pieces bought and the total cost in the second two-month period of 2003.

SELECT supplName, type, SUM(#components), SUM(cost)+SUM(delivery_cost) FROM TimeAss t, Assembling A

WHERE t.timeIdA=A.timeIdA AND year = '2003' AND 2M = '2-2003' AND supplName IN (SELECT supplName

FROM Assembling A2 WHERE year=’2003’

GROUP BY supplName

HAVING SUM(#components)>100000) GROUP BY supplName, component_type;

Riferimenti

Documenti correlati

Give a rank according to the total number of free properties (rank 1 st the highest number). Sort the data according to the rank. c) In summer 2005, including only the attics

The hotel chain managers would like to analyze the daily, holiday, monthly and yearly income. Some frequent queries the managers would like to execute are the following. a) In

a) Considering only Italian routes, for each category of goods and for each year, select the average daily income for each month and the total monthly income since

ratio, considering only configurations having both RAM and CPU from the same supplier. d) Considering only 2002, for each configuration whose RAM has been bought

Tratto da Golfarelli, Rizzi,”Data warehouse, teoria e pratica della progettazione”, McGraw Hill 2006..

Tratto da Golfarelli, Rizzi,”Data warehouse, teoria e pratica della progettazione”, McGraw Hill 2006...

Per ogni regione, selezionare il prezzo medio al litro, il numero medio di litri di vino esportati per provincia (es. il Piemonte ha 8 province, quindi il totale dei litri esportati

As for the value of Resistance to Uniaxial Compressive Strenght, the survey refers to the results obtained by the compressive press, being it a direct test; the instrument