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

Convert text to sql: Find the name of physicians who are affiliated with Surgery or Psychiatry department. | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select physician.name from physician join affiliated_with on physician.employeeid = affiliated_with.physician join department on affiliated_with.department = department.departmentid where department.name = 'Surgery' or department.name = 'Psychiatry'
### Instruction:

Convert text to sql: Which physicians are affiliated with either Surgery or Psychiatry department? Give me their names. | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select physician.name from physician join affiliated_with on physician.employeeid = affiliated_with.physician join department on affiliated_with.department = department.departmentid where department.name = 'Surgery' or department.name = 'Psychiatry'
### Instruction:

Convert text to sql: Find the names of patients who are not using the medication of Procrastin-X. | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select name from patient except select patient.name from patient join prescribes on prescribes.patient = patient.ssn join medication on prescribes.medication = medication.code where medication.name = 'Procrastin-X'
### Instruction:

Convert text to sql: What are the names of patients who are not taking the medication of Procrastin-X. | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select name from patient except select patient.name from patient join prescribes on prescribes.patient = patient.ssn join medication on prescribes.medication = medication.code where medication.name = 'Procrastin-X'
### Instruction:

Convert text to sql: Find the number of patients who are not using the medication of Procrastin-X. | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select count ( * ) from patient where ssn not in ( select prescribes.patient from prescribes join medication on prescribes.medication = medication.code where medication.name = 'Procrastin-X' )
### Instruction:

Convert text to sql: How many patients are not using Procrastin-X as medication? | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select count ( * ) from patient where ssn not in ( select prescribes.patient from prescribes join medication on prescribes.medication = medication.code where medication.name = 'Procrastin-X' )
### Instruction:

Convert text to sql: How many appointments are there? | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select count ( * ) from appointment
### Instruction:

Convert text to sql: Count how many appointments have been made in total. | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select count ( * ) from appointment
### Instruction:

Convert text to sql: Find the names of nurses who are on call. | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select distinct nurse.name from nurse join on_call on nurse.employeeid = on_call.nurse
### Instruction:

Convert text to sql: What are the distinct names of nurses on call? | physician : employeeid , name , position , ssn | department : departmentid , name , head | affiliated_with : physician , department , primaryaffiliation | procedures : code , name , cost | trained_in : physician , treatment , certificationdate , certificationexpires | patient : ssn , name , address , phone , insuranceid , pcp | nurse : employeeid , name , position , registered , ssn | appointment : appointmentid , patient , prepnurse , physician , start , end , examinationroom | medication : code , name , brand , description | prescribes : physician , patient , medication , date , appointment , dose | block : blockfloor , blockcode | room : roomnumber , roomtype , blockfloor , blockcode , unavailable | on_call : nurse , blockfloor , blockcode , oncallstart , oncallend | stay : stayid , patient , room , staystart , stayend | undergoes : patient , procedures , stay , dateundergoes , physician , assistingnurse | department.head = physician.employeeid | affiliated_with.department = department.departmentid | affiliated_with.physician = physician.employeeid | trained_in.treatment = procedures.code | trained_in.physician = physician.employeeid | patient.pcp = physician.employeeid | appointment.physician = physician.employeeid | appointment.prepnurse = nurse.employeeid | appointment.patient = patient.ssn | prescribes.appointment = appointment.appointmentid | prescribes.medication = medication.code | prescribes.patient = patient.ssn | prescribes.physician = physician.employeeid | room.blockfloor = block.blockfloor | room.blockcode = block.blockcode | on_call.blockfloor = block.blockfloor | on_call.blockcode = block.blockcode | on_call.nurse = nurse.employeeid | stay.room = room.roomnumber | stay.patient = patient.ssn | undergoes.assistingnurse = nurse.employeeid | undergoes.physician = physician.employeeid | undergoes.stay = stay.stayid | undergoes.procedures = procedures.code | undergoes.patient = patient.ssn | 

### Response:

select distinct nurse.name from nurse join on_call on nurse.employeeid = on_call.nurse