Task: Text to Code
Input (English): Step 1: For each row in Student_Course_Enrolment table, find corresponding rows in Students table and in Student_Tests_Taken table.
Step 2: find date_of_latest_logon of the results of step 1 whose test_result equals Fail
Output (English): SELECT T1.date_of_latest_logon FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id JOIN Student_Tests_Taken AS T3 ON T2.registration_id = T3.registration_id WHERE T3.test_result = "Fail"