brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
What is the employee id of the head whose department has the least number of employees?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT head FROM department 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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 are names of patients who made an appointment?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn
List the names of patients who have made appointments.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn
what are name and phone number of patients who had more than one appointment?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name , phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING count(*) > 1
Find the id of the appointment with the most recent start date?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1
What is the id of the appointment that started most recently?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1
List the name of physicians who took some appointment.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID
Find the names of all physicians and their primary affiliated departments' names.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 is the name of the patient who made the most recent appointment?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1
How many patients stay in room 112?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT count(patient) FROM stay WHERE room = 112
Count the number of patients who stayed in room 112.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT count(patient) FROM stay WHERE room = 112
How many patients' prescriptions are made by physician John Dorian?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 name of medication used on the patient who stays in room 111?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 patient who most recently stayed in room 111.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1
What is the name of the nurse has the most appointments?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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
How many patients do each physician take care of? List their names and number of patients they take care of.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT T1.name , count(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid
Find the name of physicians who are in charge of more than one patient.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 number of rooms located on each block floor.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 for different block code?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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
What are the unique block codes that have available rooms?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT blockcode FROM room WHERE unavailable = 0
Tell me the distinct block codes where some rooms are available.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT blockcode FROM room WHERE unavailable = 0
How many different types of rooms are there?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT count(DISTINCT roomtype) FROM room
Find the number of distinct room types available.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT count(DISTINCT roomtype) FROM room
What is the names of the physicians who prescribe medication Thesisin?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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"
Find the name and position of physicians who prescribe some medication whose brand is X?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 number of medications prescribed for each brand.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT count(*) , T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand
Find the name of physicians whose position title contains the word 'senior'.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name FROM physician WHERE POSITION LIKE '%senior%'
What are the names of the physicians who have 'senior' in their titles.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name FROM physician WHERE POSITION LIKE '%senior%'
Find the patient who has the most recent undergoing treatment?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1
Which patient is undergoing the most recent treatment?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1
Find the names of all patients who have an undergoing treatment and are staying in room 111.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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
List the names of all distinct nurses ordered by alphabetical order?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT name FROM nurse ORDER BY name
What is the alphabetically ordered list of all the distinct names of nurses?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT name FROM nurse ORDER BY name
Find the names of nurses who are nursing an undergoing treatment.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID
List the names of all distinct medications, ordered in an alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT name FROM medication ORDER BY name
What is the alphabetically ordered list of all distinct medications?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT name FROM medication ORDER BY name
What are the names of the physician who prescribed the highest dose?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1
List the physicians' employee ids together with their primary affiliation departments' ids.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1
What are each physician's employee id and department id primarily affiliated.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1
List the names of departments where some physicians are primarily affiliated with.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1
What nurses are on call with block floor 1 and block code 1? Tell me their names.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1
What are the highest cost, lowest cost and average cost of procedures?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT MAX(cost) , MIN(cost) , AVG(cost) FROM procedures
Tell me the highest, lowest, and average cost of procedures.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT MAX(cost) , MIN(cost) , AVG(cost) FROM procedures
List the name and cost of all procedures sorted by the cost from the highest to the lowest.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name , cost FROM procedures ORDER BY cost DESC
Find the three most expensive procedures.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name FROM procedures ORDER BY cost LIMIT 3
What are the three most costly procedures?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT name FROM procedures ORDER BY cost LIMIT 3
Find the physicians who are trained in a procedure that costs more than 5000.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 physician who was trained in the most expensive procedure?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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
What is the average cost of procedures that physician John Wen was trained in?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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"
Find the names of procedures which physician John Wen was trained in.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 the names of all procedures which cost more than 1000 but which physician John Wen was not trained in?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 such that the cost is less than 5000 and physician John Wen was trained in.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 name of physicians who are affiliated with both Surgery and Psychiatry departments.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.d...
Which physicians are affiliated with both Surgery and Psychiatry departments? Tell me their names.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.d...
Find the name of physicians who are affiliated with Surgery or Psychiatry department.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 names of patients who are not using the medication of Procrastin-X.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 number of patients who are not using the medication of Procrastin-X.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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 appointments are there?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT count(*) FROM appointment
Count how many appointments have been made in total.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT count(*) FROM appointment
Find the names of nurses who are on call.
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
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?
-- Language PostgreSQL -- Tables: -- Table: physician columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']] -- Table: department columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']] -- Table: affiliated with columns...
SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse
How many ships are there?
-- Language PostgreSQL -- Tables: -- Table: mission columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']] -- Table: ship columns : [['ship id', 'number'], ['name', '...
SELECT count(*) FROM ship
What is the number of ships?
-- Language PostgreSQL -- Tables: -- Table: mission columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']] -- Table: ship columns : [['ship id', 'number'], ['name', '...
SELECT count(*) FROM ship