• Non ci sono risultati.

Tema esame SGBD 2016-09-09 Datawarehouse

N/A
N/A
Protected

Academic year: 2021

Condividi "Tema esame SGBD 2016-09-09 Datawarehouse"

Copied!
4
0
0

Testo completo

(1)

Tema esame SGBD 2016-09-09

Datawarehouse

English version

An international company is interested in analyzing the number of working and non-working hours (paid holidays) of their employees in its different branches all over the world and in different periods of the year.

Each employee works in a specific department in one of the branches, and, in a specific date, he/she can sum up a given number of working hours and a given number of non-working hours (even zero). Each day can be a working day or a holiday.

The company is particularly interested in analyzing the number of hours in the following periods of the year: from January to May (period 1), from June to September (period 2), and from October to December (period 3) of each year.

Each branch is located in a region, which belongs to a state. States are grouped into disjoint sale areas of the world. Each department has a specific activity sector, for instance: administration, financial, production, sales, etc.

Each employee is characterized by a role and a salary level.

The company is interested in analyzing the number of working hours, non-working hours (paid holidays), working days, and holidays, according to:

- month, 2-month period, 3-month period, semester, year

- month of the year, semester of the year, period (1-2-3), period (1-2-3) of the year - department, branch, region, state, sale area, activity sector

- role and salary level

Query 1

Separately for each period (1-2-3) of each year, select

- the total number of non-working hours for each department,

- the percentage of non-working hours for each department with respect to the total of its activity sector

Query 2

For each year, separately for each branch, select

- the number of daily-average working hours (considering only the working days), - the number of daily-average non-working hours (considering only the working days), - the percentage of non-working hours with respect to the total of the working hours, - the percentage of working hours with respect to the total of the working hours of all

branches of the state

(2)

Italian version

Un’azienda multinazionale è interessata ad analizzare la fruizione di ferie e le ore lavorate dai propri dipendenti nelle varie sedi e nei vari periodi dell’anno.

Ogni dipendente lavora in uno specifico dipartimento di una delle sedi, e in un determinato giorno, può lavorare un certo numero di ore e può usufruire di ferie (ore di assenza dal lavoro). I giorni di calendario possono essere lavorativi o festivi.

L’azienda è particolarmente interessata ad analizzare la fruizione di ore di ferie e le ore lavorate da gennaio a maggio (periodo 1), da giugno a settembre (periodo 2) e da ottobre a dicembre di ogni anno (periodo 3).

Ogni sede è situata in una regione, che appartiene ad uno stato. I vari stati del mondo sono raggruppati in zone commerciali: ogni stato appartiene ad una sola zona commerciale.

Ogni dipartimento appartiene ad un settore di attività specifico, es. amministrativo, produttivo, commerciale, ecc.

Ogni dipendente è caratterizzato da una specifica mansione e da un livello contrattuale.

L’azienda è interessata ad analizzare il numero di ore totali di ferie, il numero di ore totali lavorative, il numero totale di giorni lavorativi e festivi (separatamente), al variare delle seguenti condizioni:

- mese, bimestre, trimestre, semestre, anno,

- mese dell’anno, semestre dell’anno, periodo (1-2-3), e periodo (1-2-3) dell’anno - dipartimento, sede, regione, stato, zona commerciale, settore di attività

- mansione e livello

(3)

Query 1

Separatamente per ogni periodo di ogni anno, selezionare - il totale delle ore di ferie per ogni dipartimento,

- la percentuale di ore di ferie di ogni dipartimento rispetto al totale del relativo settore di attività.

SELECT DIPARTIMENTO, SETTORE, PERIODO, (ANNO) SUM(ORE_FERIE) AS TOTALE_DIPARTIMENTO,

100*SUM(ORE_FERIE) / SUM(SUM(ORE_FERIE)) OVER ( PARTITION BY SETTORE, PERIODO)

FROM … WHERE ...

GROUP BY DIPARTIMENTO, SETTORE, PERIODO, (ANNO)

Query 2

Per ogni anno, separatamente per ogni sede, selezionare

- la media giornaliera di ore lavorate (considerando solo i giorni lavorativi), - la media giornaliera di ore di ferie (considerando solo i giorni lavorativi), - la percentuale di ore di ferie rispetto al totale delle ore lavorate,

- la percentuale di ore lavorate rispetto al totale delle ore lavorate in tutte le sedi dello stato cui appartengono.

SELECT ANNO, SEDE, STATO

SUM(ORE_LAVORATE) / SUM(GIORNI_LAVORATIVI), SUM(ORE_FERIE) / SUM(GIORNI_LAVORATIVI), 100*SUM(ORE_FERIE) / SUM(ORE_LAVORATE),

100*SUM(ORE_LAVORATE) / SUM(SUM(ORE_LAVORATE)) OVER ( PARTITION BY ANNO, STATO)

FROM … WHERE ...

GROUP BY ANNO, SEDE, STATO

(4)

SOLUZIONE CONCETTUALE

Riferimenti

Documenti correlati

Chiarle A & Isaia M 2013 Signal complexity and modular organi- zation of the courtship behaviours of two sibling species of wolf spiders (Araneae: Lycosidae). PhD

The purpose of the present study was to identify polymorphisms and evaluate the association between polymorphisms in three studied genes—IGF1 (insulin-like growth factor 1),

The diagnosis of NPHPT was based on the finding of normal alb-sCa and abnormally increased plasma PTH levels – the upper normal limit was calculated as detailed below – provided

Methods: This study evaluated 12 patients with anterior shoulder instability who had undergone arthroscopic stabilization with the Bankart technique and various resorbable anchors

For the Future of Work , a special project from the Center for Advanced Study in the Behavioral Sciences at Stanford University, business and labor leaders, social

While within the wide category of T/ICTM the sources of information at national level use a variety of terms and concepts, for the purpose of this study the terminology for the

This option allowed employees to choose between a wage increase of about three per cent or additional leisure time of around five hours per month (Gerold and Nocker, 2015)based

In the new world of remote working though, the question of what an employer can and cannot require of its staff has suddenly become much more complicated.. Today’s employment laws