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

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What is the status code with the least number of customers?
SQL: SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?
SQL: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id  = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed";
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: How many lessons did the customer Ryan Goodwin complete?
SQL: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id  = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed";
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What is maximum, minimum and average amount of outstanding of customer?
SQL: SELECT max(amount_outstanding) ,  min(amount_outstanding) ,  avg(amount_outstanding) FROM Customers;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What is the maximum, minimum, and average amount of money outsanding for all customers?
SQL: SELECT max(amount_outstanding) ,  min(amount_outstanding) ,  avg(amount_outstanding) FROM Customers;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: List the first name and last name of customers have the amount of outstanding between 1000 and 3000.
SQL: SELECT first_name ,  last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What are the first and last names of all customers with between 1000 and 3000 dollars outstanding?
SQL: SELECT first_name ,  last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: List first name and last name of customers lived in city Lockmanfurt.
SQL: SELECT T1.first_name ,  T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt";
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What are the first and last names of all customers who lived in Lockmanfurt?
SQL: SELECT T1.first_name ,  T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt";
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: Which country does customer with first name as Carole and last name as Bernhard lived in?
SQL: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What is the country in which the customer Carole Bernhard lived?
SQL: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What is zip code of customer with first name as Carole and last name as Bernhard?
SQL: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What is the zip code of the customer Carole Bernhard?
SQL: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: Which city does has most number of customers?
SQL: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What is the city with the most customers?
SQL: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: How much in total does customer with first name as Carole and last name as Bernhard paid?
SQL: SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What is the total amount of moeny paid by the customer Carole Bernhard?
SQL: SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: List the number of customers that did not have any payment history.
SQL: SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: How many customers have no payment histories?
SQL: SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: List first name and last name of customers that have more than 2 payments.
SQL: SELECT T2.first_name ,  T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*)  >  2;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: What are the first and last names of all customers with more than 2 payments?
SQL: SELECT T2.first_name ,  T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*)  >  2;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: List all payment methods and number of payments using each payment methods.
SQL: SELECT payment_method_code ,  count(*) FROM Customer_Payments GROUP BY payment_method_code;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: For each payment method, how many payments were made?
SQL: SELECT payment_method_code ,  count(*) FROM Customer_Payments GROUP BY payment_method_code;
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: How many lessons were in cancelled state?
SQL: SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled";
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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.



Question: How many lessons have been cancelled?
SQL: SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled";