Database: hospital_1

Question: Return the name of each physician and the number of patients he or she treats.
SQL: SELECT T1.name ,  count(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid  =  T2.PCP GROUP BY T1.employeeid

Question: Which physicians are in charge of more than one patient? Give me their names.
SQL: SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid  =  T2.PCP GROUP BY T1.employeeid HAVING count(*)  >  1

Question: How many rooms does each block floor have?
SQL: 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

Question: How many rooms are located for each block code?
SQL: 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

Question: Tell me the distinct block codes where some rooms are available.
SQL: SELECT DISTINCT blockcode FROM room WHERE unavailable  =  0

Question: Find the number of distinct room types available.
SQL: SELECT count(DISTINCT roomtype) FROM room

Question: List the names of all the physicians who prescribe Thesisin as medication.
SQL: 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"

Question: Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.
SQL: 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"

Question: How many medications are prescribed for each brand?
SQL: SELECT count(*) ,  T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand

Question: What are the names of the physicians who have 'senior' in their titles.
SQL: SELECT name FROM physician WHERE POSITION LIKE '%senior%'

Question: Which patient is undergoing the most recent treatment?
SQL: SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1

Question: What are the names of patients who are staying in room 111 and have an undergoing treatment?
SQL: 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

Question: What is the alphabetically ordered list of all the distinct names of nurses?
SQL: SELECT DISTINCT name FROM nurse ORDER BY name

Question: Which nurses are in charge of patients undergoing treatments?
SQL: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse  =  T2.EmployeeID

Question: What is the alphabetically ordered list of all distinct medications?
SQL: SELECT DISTINCT name FROM medication ORDER BY name

Question: Find the physician who prescribed the highest dose. What is his or her name?
SQL: SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1