Der Antwortdatensatz des Benutzers im Niuke-Testpapier-Antwortbereich wird in der Tabelle exam_record gespeichert und hat folgenden Inhalt:
Tabelle „exam_record“ (UID-Benutzer-ID, Exam_ID-Prüfungspapier-ID, „Startzeit“ für den Beginn der Beantwortung, „Submit_time“-Abgabezeit, Punktestand)
Ausweis | uid | exam_id | Startzeit | send_time | Punktzahl |
1 | 1001 | 9001 | 2021-07-02 09:01:01 | 2021-07-02 09:21:01 | 80 |
2 | 1002 | 9001 | 2021-09-05 19:01:01 | 2021-09-05 19:40:01 | 81 |
3 | 1002 | 9002 | 2021-09-02 12:01:01 | (NULL) | (NULL) |
4 | 1002 | 9003 | 2021-09-01 12:01:01 | (NULL) | (NULL) |
5 | 1002 | 9001 | 2021-07-02 19:01:01 | 2021-07-02 19:30:01 | 82 |
6 | 1002 | 9002 | 2021-07-05 18:01:01 | 2021-07-05 18:59:02 | 90 |
7 | 1003 | 9002 | 2021-07-06 12:01:01 | (NULL) | (NULL) |
8 | 1003 | 9003 | 2021-09-07 10:01:01 | 2021-09-07 10:31:01 | 86 |
9 | 1004 | 9003 | 2021-09-06 12:01:01 | (NULL) | (NULL) |
10 | 1002 | 9003 | 2021-09-01 12:01:01 | 2021-09-01 12:31:01 | 81 |
11 | 1005 | 9001 | 2021-09-01 12:01:01 | 2021-09-01 12:31:01 | 88 |
12 | 1006 | 9002 | 2021-09-02 12:11:01 | 2021-09-02 12:31:01 | 89 |
13 | 1007 | 9002 | 2020-09-02 12:11:01 | 2020-09-02 12:31:01 | 89 |
select date_format(submit_time,'%Y%m') as month
,round((count(distinct uid,date_format(submit_time,'%Y%m%d')))/count(distinct uid),2) as avg_active_days
,count(distinct uid) as mau
from exam_record
where submit_time is not null
and year(submit_time) = 2021
group by date_format(submit_time,'%Y%m')
Bitte berechnen Sie die durchschnittlichen monatlichen aktiven Tage avg_active_days und die monatliche aktive Anzahl mau der Benutzer im Testpapier-Antwortbereich in jedem Monat des Jahres 2021. Die Beispielausgabe der oben genannten Daten sieht wie folgt aus:
Monat | avg_active_days | stets |
202107 | 1,50 | 2 |
202109 | 1,25 | 4 |