brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
List each test result and its count in descending order of count. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `List each test result and its count in descending order of count.` to a syntactically-correct PostgreSQL query.
| SELECT test_result , COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC |
For each distinct test result, find the number of students who got the result. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `For each distinct test result, find the number of students who got the result.` to a syntactically-correct PostgreSQL query.
| SELECT test_result , COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC |
Find the login name of the course author that teaches the course with name "advanced database". |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the login name of the course author that teaches the course with name "advanced database".` to a syntactically-correct PostgreSQL query.
| SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "advanced database" |
Which course author teaches the "advanced database" course? Give me his or her login name. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Which course author teaches the "advanced database" course? Give me his or her login name.` to a syntactically-correct PostgreSQL query.
| SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "advanced database" |
Find the addresses of the course authors who teach the course with name "operating system" or "data structure". |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the addresses of the course authors who teach the course with name "operating system" or "data structure".` to a syntactically-correct PostgreSQL query.
| SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "operating system" OR T2.course_name = "data structure" |
What are the addresses of the course authors who teach either "operating system" or "data structure" course. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the addresses of the course authors who teach either "operating system" or "data structure" course.` to a syntactically-correct PostgreSQL query.
| SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "operating system" OR T2.course_name = "data structure" |
Find the personal name, family name, and author ID of the course author that teaches the most courses. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the personal name, family name, and author ID of the course author that teaches the most courses.` to a syntactically-correct PostgreSQL query.
| SELECT T1.personal_name , T1.family_name , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1 |
What are the personal name, family name, and author ID of the course author who teaches the most courses? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the personal name, family name, and author ID of the course author who teaches the most courses?` to a syntactically-correct PostgreSQL query.
| SELECT T1.personal_name , T1.family_name , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1 |
Find the addresses and author IDs of the course authors that teach at least two courses. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the addresses and author IDs of the course authors that teach at least two courses.` to a syntactically-correct PostgreSQL query.
| SELECT T1.address_line_1 , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id HAVING Count(*) >= 2 |
Which course authors teach two or more courses? Give me their addresses and author IDs. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Which course authors teach two or more courses? Give me their addresses and author IDs.` to a syntactically-correct PostgreSQL query.
| SELECT T1.address_line_1 , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id HAVING Count(*) >= 2 |
Find the names of courses taught by the tutor who has personal name "Julio". |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the names of courses taught by the tutor who has personal name "Julio".` to a syntactically-correct PostgreSQL query.
| SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = "Julio" |
What are the names of the courses taught by the tutor whose personal name is "Julio"? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the names of the courses taught by the tutor whose personal name is "Julio"?` to a syntactically-correct PostgreSQL query.
| SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = "Julio" |
Find the names and descriptions of courses that belong to the subject named "Computer Science". |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the names and descriptions of courses that belong to the subject named "Computer Science".` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_name , T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = "Computer Science" |
What are the names and descriptions of the all courses under the "Computer Science" subject? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the names and descriptions of the all courses under the "Computer Science" subject?` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_name , T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = "Computer Science" |
Find the subject ID, subject name, and the corresponding number of available courses for each subject. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the subject ID, subject name, and the corresponding number of available courses for each subject.` to a syntactically-correct PostgreSQL query.
| SELECT T1.subject_id , T2.subject_name , COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id |
What are the subject ID, subject name, and the number of available courses for each subject? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the subject ID, subject name, and the number of available courses for each subject?` to a syntactically-correct PostgreSQL query.
| SELECT T1.subject_id , T2.subject_name , COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id |
Find the subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order.` to a syntactically-correct PostgreSQL query.
| SELECT T1.subject_id , T2.subject_name , COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC |
List the subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `List the subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts.` to a syntactically-correct PostgreSQL query.
| SELECT T1.subject_id , T2.subject_name , COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC |
What is the date of enrollment of the course named "Spanish"? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What is the date of enrollment of the course named "Spanish"?` to a syntactically-correct PostgreSQL query.
| SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "Spanish" |
Find the the date of enrollment of the "Spanish" course. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the the date of enrollment of the "Spanish" course.` to a syntactically-correct PostgreSQL query.
| SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "Spanish" |
What is the name of the course that has the most student enrollment? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What is the name of the course that has the most student enrollment?` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1 |
Which course is enrolled in by the most students? Give me the course name. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Which course is enrolled in by the most students? Give me the course name.` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1 |
What are the names of the courses that have exactly 1 student enrollment? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the names of the courses that have exactly 1 student enrollment?` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) = 1 |
Find the names of the courses that have just one student enrollment. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the names of the courses that have just one student enrollment.` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) = 1 |
What are the descriptions and names of the courses that have student enrollment bigger than 2? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the descriptions and names of the courses that have student enrollment bigger than 2?` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_description , T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) > 2 |
Return the descriptions and names of the courses that have more than two students enrolled in. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Return the descriptions and names of the courses that have more than two students enrolled in.` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_description , T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) > 2 |
What is the name of each course and the corresponding number of student enrollment? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What is the name of each course and the corresponding number of student enrollment?` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_name , COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name |
List the name and the number of enrolled student for each course. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `List the name and the number of enrolled student for each course.` to a syntactically-correct PostgreSQL query.
| SELECT T1.course_name , COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name |
What are the enrollment dates of all the tests that have result "Pass"? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the enrollment dates of all the tests that have result "Pass"?` to a syntactically-correct PostgreSQL query.
| SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" |
Find the enrollment date for all the tests that have "Pass" result. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the enrollment date for all the tests that have "Pass" result.` to a syntactically-correct PostgreSQL query.
| SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" |
What are the completion dates of all the tests that have result "Fail"? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the completion dates of all the tests that have result "Fail"?` to a syntactically-correct PostgreSQL query.
| SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" |
Return the completion date for all the tests that have "Fail" result. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Return the completion date for all the tests that have "Fail" result.` to a syntactically-correct PostgreSQL query.
| SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" |
List the dates of enrollment and completion of the student with personal name "Karson". |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `List the dates of enrollment and completion of the student with personal name "Karson".` to a syntactically-correct PostgreSQL query.
| SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = "Karson" |
On what dates did the student whose personal name is "Karson" enroll in and complete the courses? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `On what dates did the student whose personal name is "Karson" enroll in and complete the courses?` to a syntactically-correct PostgreSQL query.
| SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = "Karson" |
List the dates of enrollment and completion of the student with family name "Zieme" and personal name "Bernie". |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `List the dates of enrollment and completion of the student with family name "Zieme" and personal name "Bernie".` to a syntactically-correct PostgreSQL query.
| SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = "Zieme" AND T2.personal_name = "Bernie" |
On what dates did the student with family name "Zieme" and personal name "Bernie" enroll in and complete the courses? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `On what dates did the student with family name "Zieme" and personal name "Bernie" enroll in and complete the courses?` to a syntactically-correct PostgreSQL query.
| SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = "Zieme" AND T2.personal_name = "Bernie" |
Find the student ID and login name of the student with the most course enrollments |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the student ID and login name of the student with the most course enrollments` to a syntactically-correct PostgreSQL query.
| SELECT T1.student_id , T2.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1 |
What are the student ID and login name of the student who are enrolled in the most courses? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the student ID and login name of the student who are enrolled in the most courses?` to a syntactically-correct PostgreSQL query.
| SELECT T1.student_id , T2.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1 |
Find the student ID and personal name of the student with at least two enrollments. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the student ID and personal name of the student with at least two enrollments.` to a syntactically-correct PostgreSQL query.
| SELECT T1.student_id , T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2 |
Which student are enrolled in at least two courses? Give me the student ID and personal name. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Which student are enrolled in at least two courses? Give me the student ID and personal name.` to a syntactically-correct PostgreSQL query.
| SELECT T1.student_id , T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2 |
Find the student ID and middle name for all the students with at most two enrollments. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the student ID and middle name for all the students with at most two enrollments.` to a syntactically-correct PostgreSQL query.
| SELECT T1.student_id , T2.middle_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) <= 2 |
What are the student IDs and middle names of the students enrolled in at most two courses? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the student IDs and middle names of the students enrolled in at most two courses?` to a syntactically-correct PostgreSQL query.
| SELECT T1.student_id , T2.middle_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) <= 2 |
Find the personal names of students not enrolled in any course. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the personal names of students not enrolled in any course.` to a syntactically-correct PostgreSQL query.
| SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id |
Which students not enrolled in any course? Find their personal names. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Which students not enrolled in any course? Find their personal names.` to a syntactically-correct PostgreSQL query.
| SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id |
How many students did not have any course enrollment? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `How many students did not have any course enrollment?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment) |
Count the number of students who did not enroll in any course. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Count the number of students who did not enroll in any course.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment) |
Find the common login name of course authors and students. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the common login name of course authors and students.` to a syntactically-correct PostgreSQL query.
| SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students |
What are the login names used both by some course authors and some students? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the login names used both by some course authors and some students?` to a syntactically-correct PostgreSQL query.
| SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students |
Find the common personal name of course authors and students. |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `Find the common personal name of course authors and students.` to a syntactically-correct PostgreSQL query.
| SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students |
What are the personal names used both by some course authors and some students? |
-- Language PostgreSQL
-- Tables:
-- Table: course authors and tutors
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]
-- Table: students
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]
-- Table: subjects
columns : [['subject id', 'number'], ['subject name', 'text']]
-- Table: courses
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]
-- Table: student course enrolment
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]
-- Table: student tests taken
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', '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.
Translate `What are the personal names used both by some course authors and some students?` to a syntactically-correct PostgreSQL query.
| SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students |
Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.Claim_id HAVING count(*) > 2 UNION SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id WHERE T1.Amount_Claimed = ( SELECT max(Amount_Claimed) FROM Claims ) |
Find the claims that led to more than two settlements or have the maximum claim value. For each of them, return the date the claim was made and the id of the claim. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the claims that led to more than two settlements or have the maximum claim value. For each of them, return the date the claim was made and the id of the claim.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.Claim_id HAVING count(*) > 2 UNION SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id WHERE T1.Amount_Claimed = ( SELECT max(Amount_Claimed) FROM Claims ) |
Which customer had at least 2 policies but did not file any claims? List the customer details and id. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Which customer had at least 2 policies but did not file any claims? List the customer details and id.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2 EXCEPT SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id |
Give me the the customer details and id for the customers who had two or more policies but did not file any claims. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Give me the the customer details and id for the customers who had two or more policies but did not file any claims.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2 EXCEPT SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id |
List the method, date and amount of all the payments, in ascending order of date. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `List the method, date and amount of all the payments, in ascending order of date.` to a syntactically-correct PostgreSQL query.
| SELECT Payment_Method_Code , Date_Payment_Made , Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC |
What are the method, date and amount of each payment? Sort the list in ascending order of date. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `What are the method, date and amount of each payment? Sort the list in ascending order of date.` to a syntactically-correct PostgreSQL query.
| SELECT Payment_Method_Code , Date_Payment_Made , Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC |
Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount.` to a syntactically-correct PostgreSQL query.
| SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1 |
Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.` to a syntactically-correct PostgreSQL query.
| SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1 |
Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount.` to a syntactically-correct PostgreSQL query.
| SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC LIMIT 1 |
Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount.` to a syntactically-correct PostgreSQL query.
| SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC LIMIT 1 |
Among all the claims, which claims have a claimed amount larger than the average? List the date the claim was made and the date it was settled. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Among all the claims, which claims have a claimed amount larger than the average? List the date the claim was made and the date it was settled.` to a syntactically-correct PostgreSQL query.
| SELECT Date_Claim_Made , Date_Claim_Settled FROM Claims WHERE Amount_Claimed > ( SELECT avg(Amount_Claimed) FROM Claims ) |
Give me the claim date, settlement date for all the claims whose claimed amount is larger than the average. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Give me the claim date, settlement date for all the claims whose claimed amount is larger than the average.` to a syntactically-correct PostgreSQL query.
| SELECT Date_Claim_Made , Date_Claim_Settled FROM Claims WHERE Amount_Claimed > ( SELECT avg(Amount_Claimed) FROM Claims ) |
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.` to a syntactically-correct PostgreSQL query.
| SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= ( SELECT avg(Amount_Settled) FROM Claims ) |
Return the claim start date for the claims whose claimed amount is no more than the average |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Return the claim start date for the claims whose claimed amount is no more than the average` to a syntactically-correct PostgreSQL query.
| SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= ( SELECT avg(Amount_Settled) FROM Claims ) |
How many settlements does each claim correspond to? List the claim id and the number of settlements. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `How many settlements does each claim correspond to? List the claim id and the number of settlements.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Claim_id , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id |
Find the number of settlements each claim corresponds to. Show the number together with the claim id. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the number of settlements each claim corresponds to. Show the number together with the claim id.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Claim_id , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id |
Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.` to a syntactically-correct PostgreSQL query.
| SELECT T1.claim_id , T1.date_claim_made , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1 |
Find the claim id and claim date of the claim that incurred the most settlement count. Also tell me the count. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the claim id and claim date of the claim that incurred the most settlement count. Also tell me the count.` to a syntactically-correct PostgreSQL query.
| SELECT T1.claim_id , T1.date_claim_made , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1 |
How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1 |
Find the claim id and the number of settlements made for the claim with the most recent settlement date. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the claim id and the number of settlements made for the claim with the most recent settlement date.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1 |
Of all the claims, what was the earliest date when any claim was made? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Of all the claims, what was the earliest date when any claim was made?` to a syntactically-correct PostgreSQL query.
| SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1 |
Tell me the the date when the first claim was made. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Tell me the the date when the first claim was made.` to a syntactically-correct PostgreSQL query.
| SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1 |
What is the total amount of settlement made for all the settlements? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `What is the total amount of settlement made for all the settlements?` to a syntactically-correct PostgreSQL query.
| SELECT sum(Amount_Settled) FROM Settlements |
Compute the total amount of settlement across all the settlements. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Compute the total amount of settlement across all the settlements.` to a syntactically-correct PostgreSQL query.
| SELECT sum(Amount_Settled) FROM Settlements |
Who are the customers that had more than 1 policy? List the customer details and id. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Who are the customers that had more than 1 policy? List the customer details and id.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id GROUP BY T1.customer_id HAVING count(*) > 1 |
Find the the customer details and id for the customers who had more than one policy. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the the customer details and id for the customers who had more than one policy.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id GROUP BY T1.customer_id HAVING count(*) > 1 |
What are the claim dates and settlement dates of all the settlements? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `What are the claim dates and settlement dates of all the settlements?` to a syntactically-correct PostgreSQL query.
| SELECT Date_Claim_Made , Date_Claim_Settled FROM Settlements |
Tell me the the claim date and settlement date for each settlement case. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Tell me the the claim date and settlement date for each settlement case.` to a syntactically-correct PostgreSQL query.
| SELECT Date_Claim_Made , Date_Claim_Settled FROM Settlements |
What is the most popular payment method? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `What is the most popular payment method?` to a syntactically-correct PostgreSQL query.
| SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) DESC LIMIT 1 |
Which payment method is used the most often? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Which payment method is used the most often?` to a syntactically-correct PostgreSQL query.
| SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) DESC LIMIT 1 |
With which kind of payment method were the least number of payments processed? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `With which kind of payment method were the least number of payments processed?` to a syntactically-correct PostgreSQL query.
| SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1 |
What is the payment method that were used the least often? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `What is the payment method that were used the least often?` to a syntactically-correct PostgreSQL query.
| SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1 |
What is the total amount of payment? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `What is the total amount of payment?` to a syntactically-correct PostgreSQL query.
| SELECT sum(Amount_Payment) FROM Payments |
Compute the total amount of payment processed. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Compute the total amount of payment processed.` to a syntactically-correct PostgreSQL query.
| SELECT sum(Amount_Payment) FROM Payments |
What are all the distinct details of the customers? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `What are all the distinct details of the customers?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT customer_details FROM Customers |
Return the distinct customer details. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Return the distinct customer details.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT customer_details FROM Customers |
Which kind of policy type was chosen by the most customers? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Which kind of policy type was chosen by the most customers?` to a syntactically-correct PostgreSQL query.
| SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY count(*) DESC LIMIT 1 |
Find the policy type the most customers choose. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the policy type the most customers choose.` to a syntactically-correct PostgreSQL query.
| SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY count(*) DESC LIMIT 1 |
How many settlements are there in total? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `How many settlements are there in total?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Settlements |
Count the total number of settlements made. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Count the total number of settlements made.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Settlements |
Which Payments were processed with Visa? List the payment Id, the date and the amount. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Which Payments were processed with Visa? List the payment Id, the date and the amount.` to a syntactically-correct PostgreSQL query.
| SELECT Payment_ID , Date_Payment_Made , Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa' |
Give me the payment Id, the date and the amount for all the payments processed with Visa. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Give me the payment Id, the date and the amount for all the payments processed with Visa.` to a syntactically-correct PostgreSQL query.
| SELECT Payment_ID , Date_Payment_Made , Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa' |
List the details of the customers who do not have any policies. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `List the details of the customers who do not have any policies.` to a syntactically-correct PostgreSQL query.
| SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id |
Which customers do not have any policies? Find the details of these customers. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Which customers do not have any policies? Find the details of these customers.` to a syntactically-correct PostgreSQL query.
| SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id |
List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement.` to a syntactically-correct PostgreSQL query.
| SELECT T1.claim_id , T1.date_claim_made , T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.claim_id HAVING count(*) = 1 |
Which claims had exactly one settlement? For each, tell me the the date the claim was made, the date it was settled and the amount settled. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Which claims had exactly one settlement? For each, tell me the the date the claim was made, the date it was settled and the amount settled.` to a syntactically-correct PostgreSQL query.
| SELECT T1.claim_id , T1.date_claim_made , T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.claim_id HAVING count(*) = 1 |
Find the total claimed amount of all the claims. |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `Find the total claimed amount of all the claims.` to a syntactically-correct PostgreSQL query.
| SELECT sum(Amount_Claimed) FROM Claims |
What is total amount claimed summed across all the claims? |
-- Language PostgreSQL
-- Tables:
-- Table: customers
columns : [['customer id', 'number'], ['customer details', 'text']]
-- Table: customer policies
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]
-- Table: claims
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]
-- Table: settlements
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]
-- Table: payments
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', 'number']]
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.
Translate `What is total amount claimed summed across all the claims?` to a syntactically-correct PostgreSQL query.
| SELECT sum(Amount_Claimed) FROM Claims |
Which department has the largest number of employees? |
-- Language PostgreSQL
-- Tables:
-- Table: physician
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]
-- Table: department
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]
-- Table: affiliated with
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]
-- Table: procedures
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]
-- Table: trained in
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]
-- Table: patient
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]
-- Table: nurse
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]
-- Table: appointment
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]
-- Table: medication
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]
-- Table: prescribes
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]
-- Table: block
columns : [['block floor', 'number'], ['block code', 'number']]
-- Table: room
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]
-- Table: on call
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]
-- Table: stay
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]
-- Table: undergoes
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', 'number']]
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.
Translate `Which department has the largest number of employees?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM department GROUP BY departmentID ORDER BY count(departmentID) DESC LIMIT 1; |
Find the department with the most employees. |
-- Language PostgreSQL
-- Tables:
-- Table: physician
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]
-- Table: department
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]
-- Table: affiliated with
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]
-- Table: procedures
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]
-- Table: trained in
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]
-- Table: patient
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]
-- Table: nurse
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]
-- Table: appointment
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]
-- Table: medication
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]
-- Table: prescribes
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]
-- Table: block
columns : [['block floor', 'number'], ['block code', 'number']]
-- Table: room
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]
-- Table: on call
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]
-- Table: stay
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]
-- Table: undergoes
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', 'number']]
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.
Translate `Find the department with the most employees.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM department GROUP BY departmentID ORDER BY count(departmentID) DESC LIMIT 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.