sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many courses does the student with id 171 actually attend?
SQL: SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find id of the candidate whose email is stanley.monahan@example.org?
SQL: SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "stanley.monahan@example.org"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the id of the candidate whose email is stanley.monahan@example.org?
SQL: SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "stanley.monahan@example.org"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find id of the candidate who most recently accessed the course?
SQL: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the id of the candidate who most recently accessed the course?
SQL: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is detail of the student who registered the most number of courses?
SQL: SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the details of the student who registered for the most number of courses?
SQL: SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the id of students who registered some courses and the number of their registered courses?
SQL: SELECT T1.student_id ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: For every student who is registered for some course, how many courses are they registered for?
SQL: SELECT T1.student_id ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many registed students do each course have? List course name and the number of their registered students?
SQL: SELECT T3.course_name ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: For each course id, how many students are registered and what are the course names?
SQL: SELECT T3.course_name ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find id of candidates whose assessment code is "Pass"?
SQL: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the ids of the candidates that have an outcome code of Pass?
SQL: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the cell mobile number of the candidates whose assessment code is "Fail"?
SQL: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the cell phone numbers of the candidates that received an assessment code of "Fail"?
SQL: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the id of students who registered course 301?
SQL: SELECT student_id FROM student_course_attendance WHERE course_id  =  301
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the ids of the students who registered for course 301?
SQL: SELECT student_id FROM student_course_attendance WHERE course_id  =  301
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the id of the student who most recently registered course 301?
SQL: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the ids of the students who registered for course 301 most recently?
SQL: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find distinct cities of addresses of people?
SQL: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the different cities where people live?
SQL: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find distinct cities of address of students?
SQL: SELECT DISTINCT T1.city 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
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the different cities where students live?
SQL: SELECT DISTINCT T1.city 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
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the names of courses in alphabetical order?
SQL: SELECT course_name FROM courses ORDER BY course_name
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1', 'text'], ['line 2', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: people 
columns : [['person id', 'number'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['cell mobile number', 'text'], ['email address', 'text'], ['login name', 'text'], ['password', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['student details', 'text']]

 -- Table: courses 
columns : [['course id', 'text'], ['course name', 'text'], ['course description', 'text'], ['other details', 'text']]

 -- Table: people addresses 
columns : [['person address id', 'number'], ['person id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: student course registrations 
columns : [['student id', 'number'], ['course id', 'number'], ['registration date', 'time']]

 -- Table: student course attendance 
columns : [['student id', 'number'], ['course id', 'number'], ['date of attendance', 'time']]

 -- Table: candidates 
columns : [['candidate id', 'number'], ['candidate details', 'text']]

 -- Table: candidate assessments 
columns : [['candidate id', 'number'], ['qualification', 'text'], ['assessment date', 'time'], ['asessment outcome code', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names of the courses in alphabetical order?
SQL: SELECT course_name FROM courses ORDER BY course_name