Following are the sample rows from ActivityLog table for a person who appeared for a test: 

Person ID  | Activity | Timestamp | Activity 
ABCD1234  12-12-2020  10:10:00  Paper begins 
ABCD1234  12-12-2020  10:15:30  Selected option B for Question 4 
ABCD1234  12-12-2020  10:15:58  Deselected option for Question 4 
ABCD1234  12-12-2020  10:16:10  Selected option C for Question 4 
ABCD1234  12-12-2020  10:18:20  Paper interrupted 
ABCD1234  12-12-2020  10:45:26  Paper begins again 
ABCD1234  12-12-2020  10:46:20  Selected option D for Question 5 
ABCD1234  12-12-2020  10:47:10  Deselected option for Question 5 
ABCD1234  12-12-2020  10:50:00  Paper ends 

Write the SQL statements for the following using the table above: 
-How many and which questions did the person finally answer? Mention the questions, answers and their timestamps in a table.
-Write SQL statement to calculate the time duration for which person was not able to access the paper in between the test
-Write SQL statement to calculate total test duration and actual considerable test duration (in minutes) after excluding the duration for which paper was interrupted?

Comments (0)