richardr1126/spider-context-instruct huggingface dataset:
### Instruction:

Convert text to sql: List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS. | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select document_id from documents where document_status_code = 'done' and document_type_code = 'Paper' except select document_id from documents join ref_shipping_agents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code where ref_shipping_agents.shipping_agent_name = 'USPS'
### Instruction:

Convert text to sql: List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS. | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select document_id from documents where document_status_code = 'done' and document_type_code = 'Paper' intersect select document_id from documents join ref_shipping_agents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code where ref_shipping_agents.shipping_agent_name = 'USPS'
### Instruction:

Convert text to sql: What is draft detail of the document with id 7? | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select draft_details from document_drafts where document_id = 7
### Instruction:

Convert text to sql: How many draft copies does the document with id 2 have? | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select count ( * ) from draft_copies where document_id = 2
### Instruction:

Convert text to sql: Which document has the most draft copies? List its document id and number of draft copies. | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select document_id , count ( copy_number ) from draft_copies group by document_id order by count ( copy_number ) desc limit 1
### Instruction:

Convert text to sql: Which documents have more than 1 draft copies? List document id and number of draft copies. | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select document_id , count ( * ) from draft_copies group by document_id having count ( * ) > 1
### Instruction:

Convert text to sql: List all employees in the circulation history of the document with id 1. List the employee's name. | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select employees.employee_name from employees join circulation_history on circulation_history.employee_id = employees.employee_id where circulation_history.document_id = 1
### Instruction:

Convert text to sql: List the employees who have not showed up in any circulation history of documents. List the employee's name. | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select employee_name from employees except select employees.employee_name from employees join circulation_history on circulation_history.employee_id = employees.employee_id
### Instruction:

Convert text to sql: Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies. | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select employees.employee_name , count ( * ) from employees join circulation_history on circulation_history.employee_id = employees.employee_id group by circulation_history.document_id , circulation_history.draft_number , circulation_history.copy_number order by count ( * ) desc limit 1
### Instruction:

Convert text to sql: For each document, list the number of employees who have showed up in the circulation history of that document. List the document ids and number of employees. | ref_document_types : document_type_code , document_type_description | roles : role_code , role_description | addresses : address_id , address_details | ref_document_status : document_status_code , document_status_description | ref_shipping_agents : shipping_agent_code , shipping_agent_name , shipping_agent_description | documents : document_id , document_status_code , document_type_code , shipping_agent_code , receipt_date , receipt_number , other_details | employees : employee_id , role_code , employee_name , other_details | document_drafts : document_id , draft_number , draft_details | draft_copies : document_id , draft_number , copy_number | circulation_history : document_id , draft_number , copy_number , employee_id | documents_mailed : document_id , mailed_to_address_id , mailing_date | documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code | documents.document_status_code = ref_document_status.document_status_code | documents.document_type_code = ref_document_types.document_type_code | employees.role_code = roles.role_code | document_drafts.document_id = documents.document_id | draft_copies.document_id = document_drafts.document_id | draft_copies.draft_number = document_drafts.draft_number | circulation_history.employee_id = employees.employee_id | circulation_history.document_id = draft_copies.document_id | circulation_history.draft_number = draft_copies.draft_number | circulation_history.copy_number = draft_copies.copy_number | documents_mailed.mailed_to_address_id = addresses.address_id | documents_mailed.document_id = documents.document_id | 

### Response:

select document_id , count ( distinct employee_id ) from circulation_history group by document_id
### Instruction:

Convert text to sql: List all department names ordered by their starting date. | works_on : essn , pno , hours | employee : fname , minit , lname , ssn , bdate , address , sex , salary , super_ssn , dno | department : dname , dnumber , mgr_ssn , mgr_start_date | project : pname , pnumber , plocation , dnum | dependent : essn , dependent_name , sex , bdate , relationship | dept_locations : dnumber , dlocation | 

### Response:

select dname from department order by mgr_start_date asc

### Instruction:

Convert text to sql: find all dependent names who have a spouse relation with some employee. | works_on : essn , pno , hours | employee : fname , minit , lname , ssn , bdate , address , sex , salary , super_ssn , dno | department : dname , dnumber , mgr_ssn , mgr_start_date | project : pname , pnumber , plocation , dnum | dependent : essn , dependent_name , sex , bdate , relationship | dept_locations : dnumber , dlocation | 

### Response:

select dependent_name from dependent where relationship = 'Spouse'

### Instruction:

Convert text to sql: how many female dependents are there? | works_on : essn , pno , hours | employee : fname , minit , lname , ssn , bdate , address , sex , salary , super_ssn , dno | department : dname , dnumber , mgr_ssn , mgr_start_date | project : pname , pnumber , plocation , dnum | dependent : essn , dependent_name , sex , bdate , relationship | dept_locations : dnumber , dlocation | 

### Response:

select count ( * ) from dependent where sex = 'F'

### Instruction:

Convert text to sql: Find the names of departments that are located in Houston. | works_on : essn , pno , hours | employee : fname , minit , lname , ssn , bdate , address , sex , salary , super_ssn , dno | department : dname , dnumber , mgr_ssn , mgr_start_date | project : pname , pnumber , plocation , dnum | dependent : essn , dependent_name , sex , bdate , relationship | dept_locations : dnumber , dlocation | 

### Response:

select department.dname from department join dept_locations on department.dnumber = dept_locations.dnumber where dept_locations.dlocation = 'Houston'

### Instruction:

Convert text to sql: Return the first names and last names of employees who earn more than 30000 in salary. | works_on : essn , pno , hours | employee : fname , minit , lname , ssn , bdate , address , sex , salary , super_ssn , dno | department : dname , dnumber , mgr_ssn , mgr_start_date | project : pname , pnumber , plocation , dnum | dependent : essn , dependent_name , sex , bdate , relationship | dept_locations : dnumber , dlocation | 

### Response:

select fname , lname from employee where salary > 30000

### Instruction:

Convert text to sql: Find the number of employees of each gender whose salary is lower than 50000. | works_on : essn , pno , hours | employee : fname , minit , lname , ssn , bdate , address , sex , salary , super_ssn , dno | department : dname , dnumber , mgr_ssn , mgr_start_date | project : pname , pnumber , plocation , dnum | dependent : essn , dependent_name , sex , bdate , relationship | dept_locations : dnumber , dlocation | 

### Response:

select count ( * ) , sex from employee where salary < 50000 group by sex
### Instruction:

Convert text to sql: list the first and last names, and the addresses of all employees in the ascending order of their birth date. | works_on : essn , pno , hours | employee : fname , minit , lname , ssn , bdate , address , sex , salary , super_ssn , dno | department : dname , dnumber , mgr_ssn , mgr_start_date | project : pname , pnumber , plocation , dnum | dependent : essn , dependent_name , sex , bdate , relationship | dept_locations : dnumber , dlocation | 

### Response:

select fname , lname , address from employee order by bdate asc