human
Schema:
Addresses (address_id, line_1, line_2, city, zip_postcode, state_province_county, country)
People (person_id, first_name, middle_name, last_name, cell_mobile_number, email_address, login_name, password)
Students (student_id, student_details)
Courses (course_id, course_name, course_description, other_details)
People_Addresses (person_address_id, person_id, address_id, date_from, date_to)
Student_Course_Registrations (student_id, course_id, registration_date)
Student_Course_Attendance (student_id, course_id, date_of_attendance)
Candidates (candidate_id, candidate_details)
Candidate_Assessments (candidate_id, qualification, assessment_date, asessment_outcome_code)
Please answer with SQL.
assistant
Sure, I understand.
human
Hello! Can you show me a list of all of the student names and their associated addresses and cities? | Hi. The following table is a list of all the student name details and their associated addresses line 1 and cities. | Thank you! Can you filter the list to show just the rows that correspond with the 3 most recent 'date from' values?
assistant
SELECT T3.student_details , T1.city , T1.line_1 FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id ORDER BY date_from DESC LIMIT 3 ;