Table:
0
A
B
C
D
1
student id
course id
date of attendance
student course attendance
2
111
301
2008-11-04 10:35:13
3
121
301
2012-04-09 11:44:34
4
121
303
2014-04-09 11:44:34
5
141
302
2013-04-09 11:44:34
6
171
301
2015-04-09 11:44:34
7
161
302
2014-01-09 11:44:34
8
151
305
2012-05-09 11:44:34
9
141
301
2012-09-09 11:44:34

Questions and formulas:
Question: List the id of students who attended some courses?
Formula: UNIQUE(HSTACK(A1,B1))
Formula2: UNIQUE(HSTACK(A2:A9,B2:B9))
Level: easy
Question: What are the students who have attended at least one course?
Formula: LET(query1,SUMMARIZE(A1,SUMX(B1)),FILTER(query1,CHOOSECOLS(query1,3)>=1))
Formula2: LET(query1,SUMMARIZE(A2:A9,SUMX(B2:B9)),FILTER(query1,CHOOSECOLS(query1,3)>=1))
Level: hard
Question: What are the id of students who registered course 301?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:D1,B1=301),1))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:D9,B2:B9=301),1))
Level: medium
Question: What are the ids of the students who registered for course 301?
Formula: LET(a,A1,b,A1,c,CHOOSECOLS(UNIQUE(CHOOSECOLS(FILTER(A1:D1,B1=301),1)),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: LET(a,A2:A9,b,A2:A9,c,CHOOSECOLS(UNIQUE(CHOOSECOLS(FILTER(A2:A9:D1,B2:B9=301),1)),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard