input stringlengths 667 7.62k | output stringlengths 41 600 | db_id stringlengths 3 31 | query stringlengths 18 577 | question stringlengths 3 224 | schema stringlengths 177 6.14k | primary_keys stringlengths 16 545 | foreign_keys stringlengths 16 1.48k |
|---|---|---|---|---|---|---|---|
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the employee id of the head whose department has the least number of employees?</question>
[SQL]:
| <SQL_QUERY>SELECT head FROM department GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1;</SQL_QUERY> | hospital_1 | SELECT head FROM department GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1; | What is the employee id of the head whose department has the least number of employees? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Tell me the employee id of the head of the department with the least employees.</question>
[SQL]:
| <SQL_QUERY>SELECT head FROM department GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1;</SQL_QUERY> | hospital_1 | SELECT head FROM department GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1; | Tell me the employee id of the head of the department with the least employees. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>what is the name and position of the head whose department has least number of employees?</question>
[SQL]:
| <SQL_QUERY>SELECT T2.name , T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1;</SQL_QUERY> | hospital_1 | SELECT T2.name , T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1; | what is the name and position of the head whose department has least number of employees? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name and position of the head of the department with the least employees.</question>
[SQL]:
| <SQL_QUERY>SELECT T2.name , T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1;</SQL_QUERY> | hospital_1 | SELECT T2.name , T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1; | Find the name and position of the head of the department with the least employees. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are names of patients who made an appointment?</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn</SQL_QUERY> | hospital_1 | SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn | What are names of patients who made an appointment? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the names of patients who have made appointments.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn</SQL_QUERY> | hospital_1 | SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn | List the names of patients who have made appointments. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>what are name and phone number of patients who had more than one appointment?</question>
[SQL]:
| <SQL_QUERY>SELECT name , phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING count(*) > 1</SQL_QUERY> | hospital_1 | SELECT name , phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING count(*) > 1 | what are name and phone number of patients who had more than one appointment? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which patients made more than one appointment? Tell me the name and phone number of these patients.</question>
[SQL]:
| <SQL_QUERY>SELECT name , phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING count(*) > 1</SQL_QUERY> | hospital_1 | SELECT name , phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING count(*) > 1 | Which patients made more than one appointment? Tell me the name and phone number of these patients. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the id of the appointment with the most recent start date?</question>
[SQL]:
| <SQL_QUERY>SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1 | Find the id of the appointment with the most recent start date? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the id of the appointment that started most recently?</question>
[SQL]:
| <SQL_QUERY>SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1 | What is the id of the appointment that started most recently? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the name of physicians who took some appointment.</question>
[SQL]:
| <SQL_QUERY>SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID</SQL_QUERY> | hospital_1 | SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID | List the name of physicians who took some appointment. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the names of all the physicians who took appointments.</question>
[SQL]:
| <SQL_QUERY>SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID</SQL_QUERY> | hospital_1 | SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID | What are the names of all the physicians who took appointments. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the name of physicians who never took any appointment.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID</SQL_QUERY> | hospital_1 | SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID | List the name of physicians who never took any appointment. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which physicians have never taken any appointment? Find their names.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID</SQL_QUERY> | hospital_1 | SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID | Which physicians have never taken any appointment? Find their names. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the names of all physicians and their primary affiliated departments' names.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name , T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1</SQL_QUERY> | hospital_1 | SELECT T1.name , T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1 | Find the names of all physicians and their primary affiliated departments' names. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the name and primarily affiliated department name of each physician?</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name , T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1</SQL_QUERY> | hospital_1 | SELECT T1.name , T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1 | What are the name and primarily affiliated department name of each physician? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the name of the patient who made the most recent appointment?</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1 | What is the name of the patient who made the most recent appointment? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name of the patient who made the appointment with the most recent start date.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1 | Find the name of the patient who made the appointment with the most recent start date. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many patients stay in room 112?</question>
[SQL]:
| <SQL_QUERY>SELECT count(patient) FROM stay WHERE room = 112</SQL_QUERY> | hospital_1 | SELECT count(patient) FROM stay WHERE room = 112 | How many patients stay in room 112? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Count the number of patients who stayed in room 112.</question>
[SQL]:
| <SQL_QUERY>SELECT count(patient) FROM stay WHERE room = 112</SQL_QUERY> | hospital_1 | SELECT count(patient) FROM stay WHERE room = 112 | Count the number of patients who stayed in room 112. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many patients' prescriptions are made by physician John Dorian?</question>
[SQL]:
| <SQL_QUERY>SELECT count(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = "John Dorian"</SQL_QUERY> | hospital_1 | SELECT count(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = "John Dorian" | How many patients' prescriptions are made by physician John Dorian? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the number of patients' prescriptions physician John Dorian made.</question>
[SQL]:
| <SQL_QUERY>SELECT count(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = "John Dorian"</SQL_QUERY> | hospital_1 | SELECT count(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = "John Dorian" | Find the number of patients' prescriptions physician John Dorian made. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name of medication used on the patient who stays in room 111?</question>
[SQL]:
| <SQL_QUERY>SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111</SQL_QUERY> | hospital_1 | SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111 | Find the name of medication used on the patient who stays in room 111? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the name of the medication used for the patient staying in room 111?</question>
[SQL]:
| <SQL_QUERY>SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111</SQL_QUERY> | hospital_1 | SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111 | What is the name of the medication used for the patient staying in room 111? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the patient who most recently stayed in room 111.</question>
[SQL]:
| <SQL_QUERY>SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1 | Find the patient who most recently stayed in room 111. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the id of the patient who stayed in room 111 most recently?</question>
[SQL]:
| <SQL_QUERY>SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1 | What is the id of the patient who stayed in room 111 most recently? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the name of the nurse has the most appointments?</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY count(*) DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY count(*) DESC LIMIT 1 | What is the name of the nurse has the most appointments? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name of the nurse who has the largest number of appointments.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY count(*) DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY count(*) DESC LIMIT 1 | Find the name of the nurse who has the largest number of appointments. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many patients do each physician take care of? List their names and number of patients they take care of.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name , count(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid</SQL_QUERY> | hospital_1 | SELECT T1.name , count(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid | How many patients do each physician take care of? List their names and number of patients they take care of. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Return the name of each physician and the number of patients he or she treats.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name , count(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid</SQL_QUERY> | hospital_1 | SELECT T1.name , count(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid | Return the name of each physician and the number of patients he or she treats. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name of physicians who are in charge of more than one patient.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING count(*) > 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING count(*) > 1 | Find the name of physicians who are in charge of more than one patient. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which physicians are in charge of more than one patient? Give me their names.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING count(*) > 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING count(*) > 1 | Which physicians are in charge of more than one patient? Give me their names. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the number of rooms located on each block floor.</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) , T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor</SQL_QUERY> | hospital_1 | SELECT count(*) , T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor | Find the number of rooms located on each block floor. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many rooms does each block floor have?</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) , T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor</SQL_QUERY> | hospital_1 | SELECT count(*) , T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor | How many rooms does each block floor have? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the number of rooms for different block code?</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) , T1.blockcode FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockcode</SQL_QUERY> | hospital_1 | SELECT count(*) , T1.blockcode FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockcode | Find the number of rooms for different block code? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many rooms are located for each block code?</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) , T1.blockcode FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockcode</SQL_QUERY> | hospital_1 | SELECT count(*) , T1.blockcode FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockcode | How many rooms are located for each block code? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the unique block codes that have available rooms?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT blockcode FROM room WHERE unavailable = 0</SQL_QUERY> | hospital_1 | SELECT DISTINCT blockcode FROM room WHERE unavailable = 0 | What are the unique block codes that have available rooms? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Tell me the distinct block codes where some rooms are available.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT blockcode FROM room WHERE unavailable = 0</SQL_QUERY> | hospital_1 | SELECT DISTINCT blockcode FROM room WHERE unavailable = 0 | Tell me the distinct block codes where some rooms are available. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many different types of rooms are there?</question>
[SQL]:
| <SQL_QUERY>SELECT count(DISTINCT roomtype) FROM room</SQL_QUERY> | hospital_1 | SELECT count(DISTINCT roomtype) FROM room | How many different types of rooms are there? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the number of distinct room types available.</question>
[SQL]:
| <SQL_QUERY>SELECT count(DISTINCT roomtype) FROM room</SQL_QUERY> | hospital_1 | SELECT count(DISTINCT roomtype) FROM room | Find the number of distinct room types available. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the names of the physicians who prescribe medication Thesisin?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = "Thesisin"</SQL_QUERY> | hospital_1 | SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = "Thesisin" | What is the names of the physicians who prescribe medication Thesisin? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the names of all the physicians who prescribe Thesisin as medication.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = "Thesisin"</SQL_QUERY> | hospital_1 | SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = "Thesisin" | List the names of all the physicians who prescribe Thesisin as medication. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name and position of physicians who prescribe some medication whose brand is X?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T1.name , T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.Brand = "X"</SQL_QUERY> | hospital_1 | SELECT DISTINCT T1.name , T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.Brand = "X" | Find the name and position of physicians who prescribe some medication whose brand is X? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T1.name , T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.Brand = "X"</SQL_QUERY> | hospital_1 | SELECT DISTINCT T1.name , T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.Brand = "X" | Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the number of medications prescribed for each brand.</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) , T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand</SQL_QUERY> | hospital_1 | SELECT count(*) , T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand | Find the number of medications prescribed for each brand. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many medications are prescribed for each brand?</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) , T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand</SQL_QUERY> | hospital_1 | SELECT count(*) , T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand | How many medications are prescribed for each brand? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name of physicians whose position title contains the word 'senior'.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM physician WHERE POSITION LIKE '%senior%'</SQL_QUERY> | hospital_1 | SELECT name FROM physician WHERE POSITION LIKE '%senior%' | Find the name of physicians whose position title contains the word 'senior'. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the names of the physicians who have 'senior' in their titles.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM physician WHERE POSITION LIKE '%senior%'</SQL_QUERY> | hospital_1 | SELECT name FROM physician WHERE POSITION LIKE '%senior%' | What are the names of the physicians who have 'senior' in their titles. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the patient who has the most recent undergoing treatment?</question>
[SQL]:
| <SQL_QUERY>SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1</SQL_QUERY> | hospital_1 | SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1 | Find the patient who has the most recent undergoing treatment? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which patient is undergoing the most recent treatment?</question>
[SQL]:
| <SQL_QUERY>SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1</SQL_QUERY> | hospital_1 | SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1 | Which patient is undergoing the most recent treatment? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the names of all patients who have an undergoing treatment and are staying in room 111.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111</SQL_QUERY> | hospital_1 | SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111 | Find the names of all patients who have an undergoing treatment and are staying in room 111. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the names of patients who are staying in room 111 and have an undergoing treatment?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111</SQL_QUERY> | hospital_1 | SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111 | What are the names of patients who are staying in room 111 and have an undergoing treatment? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the names of all distinct nurses ordered by alphabetical order?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT name FROM nurse ORDER BY name</SQL_QUERY> | hospital_1 | SELECT DISTINCT name FROM nurse ORDER BY name | List the names of all distinct nurses ordered by alphabetical order? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the alphabetically ordered list of all the distinct names of nurses?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT name FROM nurse ORDER BY name</SQL_QUERY> | hospital_1 | SELECT DISTINCT name FROM nurse ORDER BY name | What is the alphabetically ordered list of all the distinct names of nurses? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the names of nurses who are nursing an undergoing treatment.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID</SQL_QUERY> | hospital_1 | SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID | Find the names of nurses who are nursing an undergoing treatment. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which nurses are in charge of patients undergoing treatments?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID</SQL_QUERY> | hospital_1 | SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID | Which nurses are in charge of patients undergoing treatments? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the names of all distinct medications, ordered in an alphabetical order.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT name FROM medication ORDER BY name</SQL_QUERY> | hospital_1 | SELECT DISTINCT name FROM medication ORDER BY name | List the names of all distinct medications, ordered in an alphabetical order. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the alphabetically ordered list of all distinct medications?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT name FROM medication ORDER BY name</SQL_QUERY> | hospital_1 | SELECT DISTINCT name FROM medication ORDER BY name | What is the alphabetically ordered list of all distinct medications? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the names of the physician who prescribed the highest dose?</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1 | What are the names of the physician who prescribed the highest dose? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the physician who prescribed the highest dose. What is his or her name?</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1 | Find the physician who prescribed the highest dose. What is his or her name? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the physicians' employee ids together with their primary affiliation departments' ids.</question>
[SQL]:
| <SQL_QUERY>SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1</SQL_QUERY> | hospital_1 | SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1 | List the physicians' employee ids together with their primary affiliation departments' ids. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are each physician's employee id and department id primarily affiliated.</question>
[SQL]:
| <SQL_QUERY>SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1</SQL_QUERY> | hospital_1 | SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1 | What are each physician's employee id and department id primarily affiliated. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the names of departments where some physicians are primarily affiliated with.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1</SQL_QUERY> | hospital_1 | SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1 | List the names of departments where some physicians are primarily affiliated with. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the names of departments that have primarily affiliated physicians.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1</SQL_QUERY> | hospital_1 | SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1 | What are the names of departments that have primarily affiliated physicians. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What nurses are on call with block floor 1 and block code 1? Tell me their names.</question>
[SQL]:
| <SQL_QUERY>SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1</SQL_QUERY> | hospital_1 | SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1 | What nurses are on call with block floor 1 and block code 1? Tell me their names. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the ids of the nurses who are on call in block floor 1 and block code 1.</question>
[SQL]:
| <SQL_QUERY>SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1</SQL_QUERY> | hospital_1 | SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1 | Find the ids of the nurses who are on call in block floor 1 and block code 1. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the highest cost, lowest cost and average cost of procedures?</question>
[SQL]:
| <SQL_QUERY>SELECT MAX(cost) , MIN(cost) , AVG(cost) FROM procedures</SQL_QUERY> | hospital_1 | SELECT MAX(cost) , MIN(cost) , AVG(cost) FROM procedures | What are the highest cost, lowest cost and average cost of procedures? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Tell me the highest, lowest, and average cost of procedures.</question>
[SQL]:
| <SQL_QUERY>SELECT MAX(cost) , MIN(cost) , AVG(cost) FROM procedures</SQL_QUERY> | hospital_1 | SELECT MAX(cost) , MIN(cost) , AVG(cost) FROM procedures | Tell me the highest, lowest, and average cost of procedures. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>List the name and cost of all procedures sorted by the cost from the highest to the lowest.</question>
[SQL]:
| <SQL_QUERY>SELECT name , cost FROM procedures ORDER BY cost DESC</SQL_QUERY> | hospital_1 | SELECT name , cost FROM procedures ORDER BY cost DESC | List the name and cost of all procedures sorted by the cost from the highest to the lowest. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Sort the list of names and costs of all procedures in the descending order of cost.</question>
[SQL]:
| <SQL_QUERY>SELECT name , cost FROM procedures ORDER BY cost DESC</SQL_QUERY> | hospital_1 | SELECT name , cost FROM procedures ORDER BY cost DESC | Sort the list of names and costs of all procedures in the descending order of cost. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the three most expensive procedures.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM procedures ORDER BY cost LIMIT 3</SQL_QUERY> | hospital_1 | SELECT name FROM procedures ORDER BY cost LIMIT 3 | Find the three most expensive procedures. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the three most costly procedures?</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM procedures ORDER BY cost LIMIT 3</SQL_QUERY> | hospital_1 | SELECT name FROM procedures ORDER BY cost LIMIT 3 | What are the three most costly procedures? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the physicians who are trained in a procedure that costs more than 5000.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000 | Find the physicians who are trained in a procedure that costs more than 5000. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which physicians are trained in procedures that are more expensive than 5000?</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000 | Which physicians are trained in procedures that are more expensive than 5000? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the physician who was trained in the most expensive procedure?</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1 | Find the physician who was trained in the most expensive procedure? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which physician was trained in the procedure that costs the most.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1 | Which physician was trained in the procedure that costs the most. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the average cost of procedures that physician John Wen was trained in?</question>
[SQL]:
| <SQL_QUERY>SELECT avg(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT avg(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | What is the average cost of procedures that physician John Wen was trained in? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Compute the mean price of procedures physician John Wen was trained in.</question>
[SQL]:
| <SQL_QUERY>SELECT avg(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT avg(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | Compute the mean price of procedures physician John Wen was trained in. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the names of procedures which physician John Wen was trained in.</question>
[SQL]:
| <SQL_QUERY>SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | Find the names of procedures which physician John Wen was trained in. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the names of procedures physician John Wen was trained in?</question>
[SQL]:
| <SQL_QUERY>SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | What are the names of procedures physician John Wen was trained in? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find all procedures which cost more than 1000 or which physician John Wen was trained in.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | Find all procedures which cost more than 1000 or which physician John Wen was trained in. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the procedures that cost more than 1000 or are specialized in by physician John Wen?</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | What are the procedures that cost more than 1000 or are specialized in by physician John Wen? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the names of all procedures which cost more than 1000 but which physician John Wen was not trained in?</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | Find the names of all procedures which cost more than 1000 but which physician John Wen was not trained in? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Among the procedures that cost more than 1000, which were not specialized in by physician John Wen?</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | Among the procedures that cost more than 1000, which were not specialized in by physician John Wen? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the names of all procedures such that the cost is less than 5000 and physician John Wen was trained in.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | Find the names of all procedures such that the cost is less than 5000 and physician John Wen was trained in. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What procedures cost less than 5000 and have John Wen as a trained physician?</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"</SQL_QUERY> | hospital_1 | SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | What procedures cost less than 5000 and have John Wen as a trained physician? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name of physicians who are affiliated with both Surgery and Psychiatry departments.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Psychiatry'</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Psychiatry' | Find the name of physicians who are affiliated with both Surgery and Psychiatry departments. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which physicians are affiliated with both Surgery and Psychiatry departments? Tell me their names.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Psychiatry'</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Psychiatry' | Which physicians are affiliated with both Surgery and Psychiatry departments? Tell me their names. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the name of physicians who are affiliated with Surgery or Psychiatry department.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry'</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry' | Find the name of physicians who are affiliated with Surgery or Psychiatry department. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Which physicians are affiliated with either Surgery or Psychiatry department? Give me their names.</question>
[SQL]:
| <SQL_QUERY>SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry'</SQL_QUERY> | hospital_1 | SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry' | Which physicians are affiliated with either Surgery or Psychiatry department? Give me their names. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the names of patients who are not using the medication of Procrastin-X.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X'</SQL_QUERY> | hospital_1 | SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X' | Find the names of patients who are not using the medication of Procrastin-X. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the names of patients who are not taking the medication of Procrastin-X.</question>
[SQL]:
| <SQL_QUERY>SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X'</SQL_QUERY> | hospital_1 | SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X' | What are the names of patients who are not taking the medication of Procrastin-X. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the number of patients who are not using the medication of Procrastin-X.</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) FROM patient WHERE SSN NOT IN ( SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X' )</SQL_QUERY> | hospital_1 | SELECT count(*) FROM patient WHERE SSN NOT IN ( SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X' ) | Find the number of patients who are not using the medication of Procrastin-X. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many patients are not using Procrastin-X as medication?</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) FROM patient WHERE SSN NOT IN ( SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X' )</SQL_QUERY> | hospital_1 | SELECT count(*) FROM patient WHERE SSN NOT IN ( SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X' ) | How many patients are not using Procrastin-X as medication? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many appointments are there?</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) FROM appointment</SQL_QUERY> | hospital_1 | SELECT count(*) FROM appointment | How many appointments are there? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Count how many appointments have been made in total.</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) FROM appointment</SQL_QUERY> | hospital_1 | SELECT count(*) FROM appointment | Count how many appointments have been made in total. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>Find the names of nurses who are on call.</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse</SQL_QUERY> | hospital_1 | SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse | Find the names of nurses who are on call. | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number);</schema>"
<primary_keys>[Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient</primary_keys>"
<foreign_keys>[Foreign Keys]: 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</foreign_keys>"
Answer the following question with a SQL Statement:<question>What are the distinct names of nurses on call?</question>
[SQL]:
| <SQL_QUERY>SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse</SQL_QUERY> | hospital_1 | SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse | What are the distinct names of nurses on call? | [Schema (values) (types)]: | hospital_1 | Physician : employeeid (text) , name (number) , position (text) , ssn (text) | Department : departmentid (text) , name (number) , head (text) | Affiliated_With : physician (text) , department (number) , primaryaffiliation (text) | Procedures : code (text) , name (number) , cost (text) | Trained_In : physician (text) , treatment (number) , certificationdate (text) , certificationexpires (text) | Patient : ssn (text) , name (number) , address (text) , phone (text) , insuranceid (number) , pcp (number) | Nurse : employeeid (text) , name (number) , position (text) , registered (text) , ssn (number) | Appointment : appointmentid (text) , patient (number) , prepnurse (text) , physician (text) , start (number) , end (number) , examinationroom (text) | Medication : code (text) , name (number) , brand (text) , description (text) | Prescribes : physician (text) , patient (number) , medication (text) , date (text) , appointment (number) , dose (number) | Block : blockfloor (text) , blockcode (number) | Room : roomnumber (text) , roomtype (number) , blockfloor (text) , blockcode (text) , unavailable (number) | On_Call : nurse (text) , blockfloor (number) , blockcode (text) , oncallstart (text) , oncallend (number) | Stay : stayid (text) , patient (number) , room (text) , staystart (text) , stayend (number) | Undergoes : patient (text) , procedures (number) , stay (text) , dateundergoes (text) , physician (number) , assistingnurse (number); | [Primary Keys]: physician : employeeid, department : departmentid, affiliated_with : physician, procedures : code, trained_in : physician, patient : ssn, nurse : employeeid, appointment : appointmentid, medication : code, prescribes : physician, block : blockfloor, room : roomnumber, on_call : nurse, stay : stayid, undergoes : patient | [Foreign Keys]: 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 |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | ship_mission | mission : mission_id (text) , ship_id (number) , code (number) , launched_year (text) , location (number) , speed_knots (text) , fate (number) | ship : ship_id (text) , name (number) , type (number) , nationality (text) , tonnage (number);</schema>"
<primary_keys>[Primary Keys]: mission : mission_id, ship : ship_id</primary_keys>"
<foreign_keys>[Foreign Keys]: mission : ship_id = ship : ship_id</foreign_keys>"
Answer the following question with a SQL Statement:<question>How many ships are there?</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) FROM ship</SQL_QUERY> | ship_mission | SELECT count(*) FROM ship | How many ships are there? | [Schema (values) (types)]: | ship_mission | mission : mission_id (text) , ship_id (number) , code (number) , launched_year (text) , location (number) , speed_knots (text) , fate (number) | ship : ship_id (text) , name (number) , type (number) , nationality (text) , tonnage (number); | [Primary Keys]: mission : mission_id, ship : ship_id | [Foreign Keys]: mission : ship_id = ship : ship_id |
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite.
<schema>[Schema (values) (types)]: | ship_mission | mission : mission_id (text) , ship_id (number) , code (number) , launched_year (text) , location (number) , speed_knots (text) , fate (number) | ship : ship_id (text) , name (number) , type (number) , nationality (text) , tonnage (number);</schema>"
<primary_keys>[Primary Keys]: mission : mission_id, ship : ship_id</primary_keys>"
<foreign_keys>[Foreign Keys]: mission : ship_id = ship : ship_id</foreign_keys>"
Answer the following question with a SQL Statement:<question>What is the number of ships?</question>
[SQL]:
| <SQL_QUERY>SELECT count(*) FROM ship</SQL_QUERY> | ship_mission | SELECT count(*) FROM ship | What is the number of ships? | [Schema (values) (types)]: | ship_mission | mission : mission_id (text) , ship_id (number) , code (number) , launched_year (text) , location (number) , speed_knots (text) , fate (number) | ship : ship_id (text) , name (number) , type (number) , nationality (text) , tonnage (number); | [Primary Keys]: mission : mission_id, ship : ship_id | [Foreign Keys]: mission : ship_id = ship : ship_id |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.