NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

-- Q1.1 - Número de turnos, por tipo, na unidade curricular de Sistemas de Apoio à Decisão

-- QUERY :
SELECT COUNT(DISTINCT TFACT.TURNO_KEY) AS NUM_TURNOS ,DTURNO.TURNO_TIPO
FROM T_FACT_INSCRITO TFACT
JOIN T_DIM_TURNO DTURNO ON DTURNO.TURNO_KEY = TFACT.TURNO_KEY
JOIN T_DIM_UC DUC ON DUC.UC_KEY=TFACT.UC_KEY
WHERE DUC.ABREV_UC='SAD'
GROUP BY DTURNO.TURNO_TIPO;

/* OUTPUT

NUM_TURNOS TURNO_TIPO
---------- --------------------------------------------------
4 PRATICA-LABORATORIAL
1 TEÓRICA

*/
-- Q1.2 - Total de estudantes inscritos em cada turno na unidade curricular de Sistemas de Apoio à Decisão

--QUERY :
SELECT COUNT(TFACT.INSCRITO) ,DTURNO.TURNO_DESC AS TURNO_TIPO
FROM T_FACT_INSCRITO TFACT
JOIN T_DIM_TURNO DTURNO ON DTURNO.TURNO_KEY = TFACT.TURNO_KEY
JOIN T_DIM_UC DUC ON DUC.UC_KEY=TFACT.UC_KEY
WHERE DUC.ABREV_UC='SAD'
GROUP BY DTURNO.TURNO_DESC
ORDER BY TURNO_DESC;

/*OUTPUT
INSCRITOS TURNO_TIPO
---------- ------------------------
18 PL
19 PL1
17 PL2
17 PL3
71 T

*/
-- Q1.3 - Número mínimo/máximo de estudantes inscritos nos turnos, por tipo de turno e ano do curso


--QUERY :
SELECT MIN(DTURNO.INSCRITOS) AS MIN_INSCRITOS, MAX(DTURNO.INSCRITOS) AS MAX_INSCRITOS, DTURNO.TURNO_TIPO, DUC.ANO_UC
FROM T_FACT_INSCRITO TFACT
JOIN T_DIM_UC DUC ON TFACT.UC_KEY = DUC.UC_KEY
JOIN T_DIM_TURNO DTURNO ON DTURNO.TURNO_KEY = TFACT.TURNO_KEY
GROUP BY DTURNO.TURNO_TIPO, DUC.ANO_UC
ORDER BY DUC.ANO_UC, DTURNO.TURNO_TIPO;

/* OUTPUT
MIN_INSCRITOS MAX_INSCRITOS TURNO_TIPO ANO_UC
------------- ------------- -------------------------------------------------- -------------------------
16 36 PRATICA-LABORATORIAL 1ºANO
33 110 TEORICO-PRATICA 1ºANO
17 31 PRATICA-LABORATORIAL 2ºANO
46 121 TEORICO-PRATICA 2ºANO
11 32 PRATICA-LABORATORIAL 3ºANO
39 86 TEÓRICA 3ºANO
*/

-- Q1.4 - Total de turnos, por tipo, nas unidades curriculares de cada área científica


--QUERY :
SELECT COUNT(DISTINCT DTURNO.TURNO_KEY) AS TOTAL_TURNOS, DTURNO.TURNO_TIPO, DUC.AREA_CIENTIFICA_UC
FROM T_FACT_INSCRITO TFACT
JOIN T_DIM_TURNO DTURNO ON DTURNO.TURNO_KEY = TFACT.TURNO_KEY
JOIN T_DIM_UC DUC ON DUC.UC_KEY = TFACT.UC_KEY
GROUP BY DTURNO.TURNO_TIPO, DUC.AREA_CIENTIFICA_UC
ORDER BY DUC.AREA_CIENTIFICA_UC;


/* OUTPUT
TOTAL_TURNOS TURNO_TIPO AREA_CIENTIFICA_UC
------------ -------------------------------------------------- ----------------------------------------------------------------------------------------------------
16 TEORICO-PRATICA Ciências de Base
14 PRATICA-LABORATORIAL Ciências de Base
14 TEORICO-PRATICA Ciências de Engenharia
41 PRATICA-LABORATORIAL Ciências de Engenharia
41 PRATICA-LABORATORIAL Engenharia Informática – Sistemas de Informação
6 TEORICO-PRATICA Engenharia Informática – Sistemas de Informação
5 TEÓRICA Engenharia Informática – Sistemas de Informação
24 PRATICA-LABORATORIAL Engenharia Informática – Tecnologias de Informação e Comunicação
3 TEORICO-PRATICA Engenharia Informática – Tecnologias de Informação e Comunicação
5 TEÓRICA Engenharia Informática – Tecnologias de Informação e Comunicação


*/


-- Q2.1 - Número de estudantes presentes em cada aula, por turno, na unidade curricular de Sistemas de Apoio à Decisão


--QUERY :
SELECT TFACT.AULA_KEY, DAULA.SEMANA, DTURNO.TURNO_TIPO, COUNT(TFACT.ALUNO_KEY) AS NUM_ESTUDANTES
FROM T_FACT_PRESENCA TFACT
JOIN T_DIM_UC DUC ON TFACT.UC_KEY = DUC.UC_KEY
JOIN T_DIM_TURNO DTURNO ON TFACT.TURNO_KEY = DTURNO.TURNO_KEY
JOIN T_DIM_AULA_SEMANA DAULA ON TFACT.AULA_KEY = DAULA.AULA_SEMANA_KEY
WHERE DUC.ABREV_UC ='SAD'
GROUP BY TFACT.AULA_KEY, DAULA.SEMANA,DTURNO.TURNO_TIPO
ORDER BY DAULA.SEMANA, TFACT.AULA_KEY;



/* OUTPUT

AULA_KEY SEMA TURNO_TIPO NUM_ESTUDANTES
---------- ---- -------------------------------------------------- --------------
32160 38 PRATICA-LABORATORIAL 18
32200 38 PRATICA-LABORATORIAL 15
32204 38 PRATICA-LABORATORIAL 14
32515 38 TEÓRICA 59
32744 38 PRATICA-LABORATORIAL 17
32199 39 PRATICA-LABORATORIAL 15
32272 39 PRATICA-LABORATORIAL 17
32551 39 PRATICA-LABORATORIAL 15
32552 39 TEÓRICA 55
32553 39 PRATICA-LABORATORIAL 14
32273 40 PRATICA-LABORATORIAL 17
32482 40 PRATICA-LABORATORIAL 16
32483 40 TEÓRICA 53
33311 40 PRATICA-LABORATORIAL 15
32036 41 PRATICA-LABORATORIAL 15
33436 41 PRATICA-LABORATORIAL 17
33437 41 PRATICA-LABORATORIAL 14
33440 41 TEÓRICA 48
33480 41 PRATICA-LABORATORIAL 16
32794 42 TEÓRICA 48
32799 42 PRATICA-LABORATORIAL 12
32855 42 PRATICA-LABORATORIAL 16
33478 42 PRATICA-LABORATORIAL 16
33532 42 PRATICA-LABORATORIAL 15
32938 43 PRATICA-LABORATORIAL 16
33058 43 PRATICA-LABORATORIAL 12
33059 43 TEÓRICA 39
33070 43 PRATICA-LABORATORIAL 12
33056 44 PRATICA-LABORATORIAL 16
33124 44 PRATICA-LABORATORIAL 14
33125 44 PRATICA-LABORATORIAL 17
33127 44 TEÓRICA 51
33135 44 PRATICA-LABORATORIAL 13
33203 45 PRATICA-LABORATORIAL 16
33293 45 PRATICA-LABORATORIAL 13
33294 45 TEÓRICA 45
33296 45 PRATICA-LABORATORIAL 14
34259 45 PRATICA-LABORATORIAL 17
32304 46 PRATICA-LABORATORIAL 16
32395 46 PRATICA-LABORATORIAL 13
32396 46 PRATICA-LABORATORIAL 14
32398 46 TEÓRICA 34
32403 46 PRATICA-LABORATORIAL 10
33735 47 PRATICA-LABORATORIAL 16
33819 47 PRATICA-LABORATORIAL 13
33820 47 PRATICA-LABORATORIAL 17
33822 47 TEÓRICA 41
33832 47 PRATICA-LABORATORIAL 13
33600 48 PRATICA-LABORATORIAL 12
33602 48 TEÓRICA 46
33606 48 PRATICA-LABORATORIAL 13
34044 48 PRATICA-LABORATORIAL 14
34260 48 PRATICA-LABORATORIAL 17
33851 49 PRATICA-LABORATORIAL 15
33923 49 PRATICA-LABORATORIAL 12
33925 49 TEÓRICA 40
33926 49 PRATICA-LABORATORIAL 12
34261 49 PRATICA-LABORATORIAL 17
33701 50 PRATICA-LABORATORIAL 16
34127 50 PRATICA-LABORATORIAL 13
34129 50 TEÓRICA 45
34130 50 PRATICA-LABORATORIAL 12
34262 50 PRATICA-LABORATORIAL 17
*/


-- Q2.2 - Número mínimo/máximo de estudantes presentes, por turno, na unidade curricular de Sistemas de Apoio à Decisão


--QUERY :

SELECT COUNTS.TURNO_DESC, MIN(PRESENTES), MAX(PRESENTES)
FROM (
SELECT DTURNO.TURNO_DESC, DAULA.SEMANA, COUNT(TFACT.PRESENTE) AS PRESENTES
FROM T_FACT_PRESENCA TFACT
JOIN T_DIM_AULA_SEMANA DAULA ON TFACT.AULA_KEY = DAULA.AULA_SEMANA_KEY
JOIN T_DIM_TURNO DTURNO ON TFACT.TURNO_KEY = DTURNO.TURNO_KEY
JOIN T_DIM_UC DUC ON TFACT.UC_KEY = DUC.UC_KEY
WHERE DUC.ABREV_UC ='SAD'
GROUP BY DTURNO.TURNO_DESC,DAULA.SEMANA
ORDER BY DTURNO.TURNO_DESC
) COUNTS
GROUP BY COUNTS.TURNO_DESC;



/* OUTPUT

TURNO_DESC MIN_PRES MAX_PRES
------------------------- ---------- ----------
PL 10 15
PL1 14 18
PL2 12 16
PL3 14 17
T 34 59


*/



-- Q2.3 - Percentagem de presenças em cada aula, por turno, na unidade curricular de Sistemas de Apoio à Decisão


--QUERY :

SELECT DISTINCT(DTURNO.TURNO_DESC), DAULA.SEMANA, ROUND((DAULA.NUM_PRESENCAS/DTURNO.INSCRITOS)*100 ,1) AS PERC_PRES
FROM T_FACT_PRESENCA TFACT
JOIN T_DIM_TURNO DTURNO ON TFACT.TURNO_KEY=DTURNO.TURNO_KEY
JOIN T_DIM_AULA_SEMANA DAULA ON DAULA.AULA_SEMANA_KEY=TFACT.AULA_KEY
JOIN T_DIM_UC DUC ON DUC.UC_KEY = TFACT.UC_KEY
WHERE DUC.ABREV_UC ='SAD'
ORDER BY DAULA.SEMANA, DTURNO.TURNO_DESC;

/* OUTPUT
TURNO_DESC SEMA PERC_PRES
------------------------- ---- ----------
PL 38 77,8
PL1 38 94,7
PL2 38 88,2
PL3 38 100
T 38 83,1
PL 39 77,8
PL1 39 89,5
PL2 39 88,2
PL3 39 88,2
T 39 77,5
PL 40 83,3
PL1 40 89,5
PL2 40 94,1
T 40 74,6
PL 41 83,3
PL1 41 84,2
PL2 41 82,4
PL3 41 100
T 41 67,6
PL 42 66,7
PL1 42 84,2
PL2 42 88,2
PL3 42 94,1
T 42 67,6
PL 43 66,7
PL1 43 84,2
PL2 43 70,6
T 43 54,9
PL 44 72,2
PL1 44 89,5
PL2 44 82,4
PL3 44 94,1
T 44 71,8
PL 45 77,8
PL1 45 89,5
PL2 45 76,5
PL3 45 94,1
T 45 63,4
PL 46 55,6
PL1 46 73,7
PL2 46 76,5
PL3 46 94,1
T 46 47,9
PL 47 72,2
PL1 47 89,5
PL2 47 76,5
PL3 47 94,1
T 47 57,7
PL 48 72,2
PL1 48 89,5
PL2 48 70,6
PL3 48 82,4
T 48 64,8
PL 49 66,7
PL1 49 89,5
PL2 49 70,6
PL3 49 88,2
T 49 56,3
PL 50 66,7
PL1 50 89,5
PL2 50 76,5
PL3 50 94,1
T 50 63,4


*/



-- Q2.4 - Média de presenças nas aulas de cada turno na unidade curricular de Sistemas de Apoio à Decisão


--QUERY :

SELECT PRESENCAS.TURNO_DESC, ROUND(AVG(PRESENTES),2) AS PERC_PRES
FROM
(
SELECT DTURNO.TURNO_DESC, DAULA.SEMANA, COUNT(TFACT.PRESENTE) AS PRESENTES
FROM T_FACT_PRESENCA TFACT
JOIN T_DIM_TURNO DTURNO ON DTURNO.TURNO_KEY = TFACT.TURNO_KEY
JOIN T_DIM_AULA_SEMANA DAULA ON DAULA.AULA_SEMANA_KEY = TFACT.AULA_KEY
JOIN T_DIM_UC DUC ON DUC.UC_KEY = TFACT.UC_KEY
WHERE DUC.ABREV_UC = 'SAD'
GROUP BY DTURNO.TURNO_DESC, DAULA.SEMANA
) PRESENCAS
GROUP BY PRESENCAS.TURNO_DESC
ORDER BY PRESENCAS.TURNO_DESC;

/* OUTPUT


TURNO_DESC MEDIA_PRES
------------------------- ----------
PL 13,14
PL1 16,67
PL2 13,73
PL3 15,86
T 47,43
*/

-- Q2.5 - Percentagem de presenças nas aulas das unidades curriculares afetas a cada departamento

--QUERY :

SELECT PRESENTES.DEPARTAMENTO_UC, ROUND((PRESENTES.PRESENTES*100/INSCRITOS.INSCRITOS)/14,2) AS MEDIA_PRES
FROM
(
SELECT DUC.DEPARTAMENTO_UC, COUNT( TFACT.ALUNO_KEY) AS PRESENTES
FROM T_FACT_PRESENCA TFACT
JOIN T_DIM_UC DUC ON DUC.UC_KEY = TFACT.UC_KEY
JOIN T_DIM_AULA_SEMANA DAULA ON DAULA.AULA_SEMANA_KEY = TFACT.AULA_KEY
GROUP BY DUC.DEPARTAMENTO_UC
) PRESENTES
JOIN
(
SELECT DUC.DEPARTAMENTO_UC, COUNT( TFACT.ALUNO_KEY) AS INSCRITOS
FROM T_FACT_INSCRITO TFACT
JOIN T_DIM_UC DUC ON DUC.UC_KEY = TFACT.UC_KEY
GROUP BY DUC.DEPARTAMENTO_UC
) INSCRITOS ON INSCRITOS.DEPARTAMENTO_UC = PRESENTES.DEPARTAMENTO_UC;


/* OUTPUT

DEPARTAMENTO_UC MEDIA_PRES
---------------------------------------------------------------------------------------------------- ----------
Engenharia Informática 49,14
Matemática 38,7
Engenharia Eletrotécnica 61,67

*/

-- Q2.6 - Momentos do semestre letivo em que existem picos de presenças (máximos/mínimos) nas aulas (e.g., início/fim do semestre, eventos, véspera de feriado, etc.)


--QUERY :
SELECT DAULA.SEMANA, DDATE.DATE_FULL_DATE, ROUND(AVG(DAULA.NUM_PRESENCAS),2) AS MED_PRES, NVL(DDATE.DATE_EVENT,'NENHUM') AS EVENTOS
FROM T_FACT_PRESENCA TFACT
JOIN T_DIM_AULA_SEMANA DAULA ON DAULA.AULA_SEMANA_KEY = TFACT.AULA_KEY
JOIN T_DIM_DATE DDATE ON DDATE.DATE_KEY = TFACT.DATE_KEY
GROUP BY DAULA.SEMANA, DDATE.DATE_FULL_DATE, DDATE.DATE_EVENT
ORDER BY DAULA.SEMANA, DDATE.DATE_FULL_DATE;


/* OUTPUT

*/
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.