messages
list
[ { "content": "What is the employee id of the head whose department has the least number of employees?", "role": "user" }, { "content": "SELECT head FROM department GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1;", "role": "assistant" } ]
[ { "content": "Tell me the employee id of the head of the department with the least employees.", "role": "user" }, { "content": "SELECT head FROM department GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1;", "role": "assistant" } ]
[ { "content": "what is the name and position of the head whose department has least number of employees?", "role": "user" }, { "content": "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;", "role": "assistant" } ]
[ { "content": "Find the name and position of the head of the department with the least employees.", "role": "user" }, { "content": "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;", "role": "assistant" } ]
[ { "content": "What are names of patients who made an appointment?", "role": "user" }, { "content": "SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn", "role": "assistant" } ]
[ { "content": "List the names of patients who have made appointments.", "role": "user" }, { "content": "SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn", "role": "assistant" } ]
[ { "content": "what are name and phone number of patients who had more than one appointment?", "role": "user" }, { "content": "SELECT name , phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING count(*) > 1", "role": "assistant" } ]
[ { "content": "Which patients made more than one appointment? Tell me the name and phone number of these patients.", "role": "user" }, { "content": "SELECT name , phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING count(*) > 1", "role": "assistant" } ]
[ { "content": "Find the id of the appointment with the most recent start date?", "role": "user" }, { "content": "SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "What is the id of the appointment that started most recently?", "role": "user" }, { "content": "SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "List the name of physicians who took some appointment.", "role": "user" }, { "content": "SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID", "role": "assistant" } ]
[ { "content": "What are the names of all the physicians who took appointments.", "role": "user" }, { "content": "SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID", "role": "assistant" } ]
[ { "content": "List the name of physicians who never took any appointment.", "role": "user" }, { "content": "SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID", "role": "assistant" } ]
[ { "content": "Which physicians have never taken any appointment? Find their names.", "role": "user" }, { "content": "SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID", "role": "assistant" } ]
[ { "content": "Find the names of all physicians and their primary affiliated departments' names.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What are the name and primarily affiliated department name of each physician?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What is the name of the patient who made the most recent appointment?", "role": "user" }, { "content": "SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "Find the name of the patient who made the appointment with the most recent start date.", "role": "user" }, { "content": "SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "How many patients stay in room 112?", "role": "user" }, { "content": "SELECT count(patient) FROM stay WHERE room = 112", "role": "assistant" } ]
[ { "content": "Count the number of patients who stayed in room 112.", "role": "user" }, { "content": "SELECT count(patient) FROM stay WHERE room = 112", "role": "assistant" } ]
[ { "content": "How many patients' prescriptions are made by physician John Dorian?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find the number of patients' prescriptions physician John Dorian made.", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find the name of medication used on the patient who stays in room 111?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What is the name of the medication used for the patient staying in room 111?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Find the patient who most recently stayed in room 111.", "role": "user" }, { "content": "SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "What is the id of the patient who stayed in room 111 most recently?", "role": "user" }, { "content": "SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "What is the name of the nurse has the most appointments?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Find the name of the nurse who has the largest number of appointments.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "How many patients do each physician take care of? List their names and number of patients they take care of.", "role": "user" }, { "content": "SELECT T1.name , count(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid", "role": "assistant" } ]
[ { "content": "Return the name of each physician and the number of patients he or she treats.", "role": "user" }, { "content": "SELECT T1.name , count(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid", "role": "assistant" } ]
[ { "content": "Find the name of physicians who are in charge of more than one patient.", "role": "user" }, { "content": "SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING count(*) > 1", "role": "assistant" } ]
[ { "content": "Which physicians are in charge of more than one patient? Give me their names.", "role": "user" }, { "content": "SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING count(*) > 1", "role": "assistant" } ]
[ { "content": "Find the number of rooms located on each block floor.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "How many rooms does each block floor have?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Find the number of rooms for different block code?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "How many rooms are located for each block code?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What are the unique block codes that have available rooms?", "role": "user" }, { "content": "SELECT DISTINCT blockcode FROM room WHERE unavailable = 0", "role": "assistant" } ]
[ { "content": "Tell me the distinct block codes where some rooms are available.", "role": "user" }, { "content": "SELECT DISTINCT blockcode FROM room WHERE unavailable = 0", "role": "assistant" } ]
[ { "content": "How many different types of rooms are there?", "role": "user" }, { "content": "SELECT count(DISTINCT roomtype) FROM room", "role": "assistant" } ]
[ { "content": "Find the number of distinct room types available.", "role": "user" }, { "content": "SELECT count(DISTINCT roomtype) FROM room", "role": "assistant" } ]
[ { "content": "What is the names of the physicians who prescribe medication Thesisin?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "List the names of all the physicians who prescribe Thesisin as medication.", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find the name and position of physicians who prescribe some medication whose brand is X?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find the number of medications prescribed for each brand.", "role": "user" }, { "content": "SELECT count(*) , T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand", "role": "assistant" } ]
[ { "content": "How many medications are prescribed for each brand?", "role": "user" }, { "content": "SELECT count(*) , T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand", "role": "assistant" } ]
[ { "content": "Find the name of physicians whose position title contains the word 'senior'.", "role": "user" }, { "content": "SELECT name FROM physician WHERE POSITION LIKE '%senior%'", "role": "assistant" } ]
[ { "content": "What are the names of the physicians who have 'senior' in their titles.", "role": "user" }, { "content": "SELECT name FROM physician WHERE POSITION LIKE '%senior%'", "role": "assistant" } ]
[ { "content": "Find the patient who has the most recent undergoing treatment?", "role": "user" }, { "content": "SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1", "role": "assistant" } ]
[ { "content": "Which patient is undergoing the most recent treatment?", "role": "user" }, { "content": "SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1", "role": "assistant" } ]
[ { "content": "Find the names of all patients who have an undergoing treatment and are staying in room 111.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What are the names of patients who are staying in room 111 and have an undergoing treatment?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "List the names of all distinct nurses ordered by alphabetical order?", "role": "user" }, { "content": "SELECT DISTINCT name FROM nurse ORDER BY name", "role": "assistant" } ]
[ { "content": "What is the alphabetically ordered list of all the distinct names of nurses?", "role": "user" }, { "content": "SELECT DISTINCT name FROM nurse ORDER BY name", "role": "assistant" } ]
[ { "content": "Find the names of nurses who are nursing an undergoing treatment.", "role": "user" }, { "content": "SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID", "role": "assistant" } ]
[ { "content": "Which nurses are in charge of patients undergoing treatments?", "role": "user" }, { "content": "SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID", "role": "assistant" } ]
[ { "content": "List the names of all distinct medications, ordered in an alphabetical order.", "role": "user" }, { "content": "SELECT DISTINCT name FROM medication ORDER BY name", "role": "assistant" } ]
[ { "content": "What is the alphabetically ordered list of all distinct medications?", "role": "user" }, { "content": "SELECT DISTINCT name FROM medication ORDER BY name", "role": "assistant" } ]
[ { "content": "What are the names of the physician who prescribed the highest dose?", "role": "user" }, { "content": "SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "Find the physician who prescribed the highest dose. What is his or her name?", "role": "user" }, { "content": "SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1", "role": "assistant" } ]
[ { "content": "List the physicians' employee ids together with their primary affiliation departments' ids.", "role": "user" }, { "content": "SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1", "role": "assistant" } ]
[ { "content": "What are each physician's employee id and department id primarily affiliated.", "role": "user" }, { "content": "SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1", "role": "assistant" } ]
[ { "content": "List the names of departments where some physicians are primarily affiliated with.", "role": "user" }, { "content": "SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1", "role": "assistant" } ]
[ { "content": "What are the names of departments that have primarily affiliated physicians.", "role": "user" }, { "content": "SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1", "role": "assistant" } ]
[ { "content": "What nurses are on call with block floor 1 and block code 1? Tell me their names.", "role": "user" }, { "content": "SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1", "role": "assistant" } ]
[ { "content": "Find the ids of the nurses who are on call in block floor 1 and block code 1.", "role": "user" }, { "content": "SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1", "role": "assistant" } ]
[ { "content": "What are the highest cost, lowest cost and average cost of procedures?", "role": "user" }, { "content": "SELECT MAX(cost) , MIN(cost) , AVG(cost) FROM procedures", "role": "assistant" } ]
[ { "content": "Tell me the highest, lowest, and average cost of procedures.", "role": "user" }, { "content": "SELECT MAX(cost) , MIN(cost) , AVG(cost) FROM procedures", "role": "assistant" } ]
[ { "content": "List the name and cost of all procedures sorted by the cost from the highest to the lowest.", "role": "user" }, { "content": "SELECT name , cost FROM procedures ORDER BY cost DESC", "role": "assistant" } ]
[ { "content": "Sort the list of names and costs of all procedures in the descending order of cost.", "role": "user" }, { "content": "SELECT name , cost FROM procedures ORDER BY cost DESC", "role": "assistant" } ]
[ { "content": "Find the three most expensive procedures.", "role": "user" }, { "content": "SELECT name FROM procedures ORDER BY cost LIMIT 3", "role": "assistant" } ]
[ { "content": "What are the three most costly procedures?", "role": "user" }, { "content": "SELECT name FROM procedures ORDER BY cost LIMIT 3", "role": "assistant" } ]
[ { "content": "Find the physicians who are trained in a procedure that costs more than 5000.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Which physicians are trained in procedures that are more expensive than 5000?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Find the physician who was trained in the most expensive procedure?", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "Which physician was trained in the procedure that costs the most.", "role": "user" }, { "content": "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", "role": "assistant" } ]
[ { "content": "What is the average cost of procedures that physician John Wen was trained in?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Compute the mean price of procedures physician John Wen was trained in.", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find the names of procedures which physician John Wen was trained in.", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "What are the names of procedures physician John Wen was trained in?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find all procedures which cost more than 1000 or which physician John Wen was trained in.", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "What are the procedures that cost more than 1000 or are specialized in by physician John Wen?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find the names of all procedures which cost more than 1000 but which physician John Wen was not trained in?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Among the procedures that cost more than 1000, which were not specialized in by physician John Wen?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find the names of all procedures such that the cost is less than 5000 and physician John Wen was trained in.", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "What procedures cost less than 5000 and have John Wen as a trained physician?", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
[ { "content": "Find the name of physicians who are affiliated with both Surgery and Psychiatry departments.", "role": "user" }, { "content": "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'", "role": "assistant" } ]
[ { "content": "Which physicians are affiliated with both Surgery and Psychiatry departments? Tell me their names.", "role": "user" }, { "content": "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'", "role": "assistant" } ]
[ { "content": "Find the name of physicians who are affiliated with Surgery or Psychiatry department.", "role": "user" }, { "content": "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'", "role": "assistant" } ]
[ { "content": "Which physicians are affiliated with either Surgery or Psychiatry department? Give me their names.", "role": "user" }, { "content": "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'", "role": "assistant" } ]
[ { "content": "Find the names of patients who are not using the medication of Procrastin-X.", "role": "user" }, { "content": "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'", "role": "assistant" } ]
[ { "content": "What are the names of patients who are not taking the medication of Procrastin-X.", "role": "user" }, { "content": "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'", "role": "assistant" } ]
[ { "content": "Find the number of patients who are not using the medication of Procrastin-X.", "role": "user" }, { "content": "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' )", "role": "assistant" } ]
[ { "content": "How many patients are not using Procrastin-X as medication?", "role": "user" }, { "content": "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' )", "role": "assistant" } ]
[ { "content": "How many appointments are there?", "role": "user" }, { "content": "SELECT count(*) FROM appointment", "role": "assistant" } ]
[ { "content": "Count how many appointments have been made in total.", "role": "user" }, { "content": "SELECT count(*) FROM appointment", "role": "assistant" } ]
[ { "content": "Find the names of nurses who are on call.", "role": "user" }, { "content": "SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse", "role": "assistant" } ]
[ { "content": "What are the distinct names of nurses on call?", "role": "user" }, { "content": "SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse", "role": "assistant" } ]
[ { "content": "How many ships are there?", "role": "user" }, { "content": "SELECT count(*) FROM ship", "role": "assistant" } ]
[ { "content": "What is the number of ships?", "role": "user" }, { "content": "SELECT count(*) FROM ship", "role": "assistant" } ]