Question: Count the total number of settlements made.

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)


Question: Which Payments were processed with Visa? List the payment Id, the date and the amount.

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)

payments : payment_id (number) , date_payment_made (time) , amount_payment (number) , payment_method_code (text)


Question: Give me the payment Id, the date and the amount for all the payments processed with Visa.

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)

payments : payment_id (number) , date_payment_made (time) , amount_payment (number) , payment_method_code (text)


Question: List the details of the customers who do not have any policies.

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)

customers : customer_details (text) , customer_id (number) | customer_policies : customer_id (number) , policy_id (number)


Question: Which customers do not have any policies? Find the details of these customers.

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)

customers : customer_details (text) , customer_id (number) | customer_policies : customer_id (number) , policy_id (number)


Question: List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement.

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)

claims : claim_id (number) , date_claim_made (time) , date_claim_settled (time) | settlements : claim_id (number) , date_claim_made (time) , date_claim_settled (time) , settlement_id (number)


Question: Which claims had exactly one settlement? For each, tell me the the date the claim was made, the date it was settled and the amount settled.

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)

claims : claim_id (number) , date_claim_made (time) , date_claim_settled (time) | settlements : claim_id (number) , date_claim_made (time) , date_claim_settled (time) , settlement_id (number)


Question: Find the total claimed amount of all the claims.

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)

claims : amount_claimed (number) , claim_id (number)


Question: What is total amount claimed summed across all the claims?

customers : customer_id (number) , customer_details (text) | customer_policies : policy_id (number) , customer_id (number) , policy_type_code (text) , start_date (time) , end_date (time) | claims : claim_id (number) , policy_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) | settlements : settlement_id (number) , claim_id (number) , date_claim_made (time) , date_claim_settled (time) , amount_claimed (number) , amount_settled (number) , customer_policy_id (number) | payments : payment_id (number) , settlement_id (number) , payment_method_code (text) , date_payment_made (time) , amount_payment (number)

claims : amount_claimed (number) , claim_id (number)


Question: Which department has the largest number of employees?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

department : name (text) , departmentid (number)


Question: Find the department with the most employees.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

department : name (text) , departmentid (number)


Question: What is the employee id of the head whose department has the least number of employees?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

department : head (number) , departmentid (number)


Question: Tell me the employee id of the head of the department with the least employees.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

department : head (number) , departmentid (number)


Question: what is the name and position of the head whose department has least number of employees?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , position (text) , employeeid (number) | department : name (text) , head (number) , departmentid (number)


Question: Find the name and position of the head of the department with the least employees.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , position (text) , employeeid (number) | department : name (text) , head (number) , departmentid (number)


Question: What are names of patients who made an appointment?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , ssn (number) | appointment : patient (number) , appointmentid (number)


Question: List the names of patients who have made appointments.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , ssn (number) | appointment : patient (number) , appointmentid (number)


Question: what are name and phone number of patients who had more than one appointment?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , phone (text) , ssn (number) | appointment : patient (number) , appointmentid (number)


Question: Which patients made more than one appointment? Tell me the name and phone number of these patients.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , phone (text) , ssn (number) | appointment : patient (number) , appointmentid (number)


Question: Find the id of the appointment with the most recent start date?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

appointment : appointmentid (number) , start (time)


Question: What is the id of the appointment that started most recently?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

appointment : appointmentid (number) , start (time)


Question: List the name of physicians who took some appointment.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | appointment : physician (number) , appointmentid (number)


Question: What are the names of all the physicians who took appointments.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | appointment : physician (number) , appointmentid (number)


Question: List the name of physicians who never took any appointment.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | appointment : physician (number) , appointmentid (number)


Question: Which physicians have never taken any appointment? Find their names.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | appointment : physician (number) , appointmentid (number)


Question: Find the names of all physicians and their primary affiliated departments' names.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | department : name (text) , departmentid (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean)


Question: What are the name and primarily affiliated department name of each physician?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | department : name (text) , departmentid (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean)


Question: What is the name of the patient who made the most recent appointment?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , ssn (number) | appointment : patient (number) , start (time) , appointmentid (number)


Question: Find the name of the patient who made the appointment with the most recent start date.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , ssn (number) | appointment : patient (number) , start (time) , appointmentid (number)


Question: How many patients stay in room 112?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

stay : patient (number) , room (number) , stayid (number) | patient : ssn (number) | room : roomnumber (number)


Question: Count the number of patients who stayed in room 112.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

stay : patient (number) , room (number) , stayid (number) | patient : ssn (number) | room : roomnumber (number)


Question: How many patients' prescriptions are made by physician John Dorian?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : ssn (number) , employeeid (number) , name (text) | patient : ssn (number) , name (text) | prescribes : patient (number) , physician (number)


Question: Find the number of patients' prescriptions physician John Dorian made.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : ssn (number) , employeeid (number) , name (text) | patient : ssn (number) , name (text) | prescribes : patient (number) , physician (number)


Question: Find the name of medication used on the patient who stays in room 111?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , ssn (number) | medication : name (text) , code (number) | prescribes : patient (number) , medication (number) , physician (number) | stay : patient (number) , room (number) , stayid (number) | room : roomnumber (number)


Question: What is the name of the medication used for the patient staying in room 111?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , ssn (number) | medication : name (text) , code (number) | prescribes : patient (number) , medication (number) , physician (number) | stay : patient (number) , room (number) , stayid (number) | room : roomnumber (number)


Question: Find the patient who most recently stayed in room 111.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

stay : patient (number) , room (number) , staystart (time) , stayid (number) | patient : ssn (number) | room : roomnumber (number)


Question: What is the id of the patient who stayed in room 111 most recently?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

stay : patient (number) , room (number) , staystart (time) , stayid (number) | patient : ssn (number) | room : roomnumber (number)


Question: What is the name of the nurse has the most appointments?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

nurse : name (text) , employeeid (number) | appointment : prepnurse (number) , appointmentid (number)


Question: Find the name of the nurse who has the largest number of appointments.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

nurse : name (text) , employeeid (number) | appointment : prepnurse (number) , appointmentid (number)


Question: How many patients do each physician take care of? List their names and number of patients they take care of.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | patient : name (text) , pcp (number) , ssn (number)


Question: Return the name of each physician and the number of patients he or she treats.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | patient : name (text) , pcp (number) , ssn (number)


Question: Find the name of physicians who are in charge of more than one patient.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | patient : name (text) , pcp (number) , ssn (number)


Question: Which physicians are in charge of more than one patient? Give me their names.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | patient : name (text) , pcp (number) , ssn (number)


Question: Find the number of rooms located on each block floor.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

block : blockfloor (number) , blockcode (number) | room : blockfloor (number) , blockcode (number) , roomnumber (number)


Question: How many rooms does each block floor have?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

block : blockfloor (number) , blockcode (number) | room : blockfloor (number) , blockcode (number) , roomnumber (number)


Question: Find the number of rooms for different block code?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

block : blockcode (number) , blockfloor (number) | room : blockcode (number) , blockfloor (number) , roomnumber (number)


Question: How many rooms are located for each block code?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

block : blockcode (number) , blockfloor (number) | room : blockcode (number) , blockfloor (number) , roomnumber (number)


Question: What are the unique block codes that have available rooms?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

room : blockcode (number) , unavailable (boolean) , roomnumber (number)


Question: Tell me the distinct block codes where some rooms are available.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

room : blockcode (number) , unavailable (boolean) , roomnumber (number)


Question: How many different types of rooms are there?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

room : roomtype (text) , roomnumber (number)


Question: Find the number of distinct room types available.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

room : roomtype (text) , roomnumber (number)


Question: What is the names of the physicians who prescribe medication Thesisin?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | medication : name (text) , code (number) | prescribes : physician (number) , medication (number)


Question: List the names of all the physicians who prescribe Thesisin as medication.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , employeeid (number) | medication : name (text) , code (number) | prescribes : physician (number) , medication (number)


Question: Find the name and position of physicians who prescribe some medication whose brand is X?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , position (text) , employeeid (number) | medication : name (text) , code (number) , brand (text) | prescribes : physician (number) , medication (number)


Question: Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , position (text) , employeeid (number) | medication : name (text) , code (number) , brand (text) | prescribes : physician (number) , medication (number)


Question: Find the number of medications prescribed for each brand.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

medication : name (text) , code (number) , brand (text) | prescribes : medication (number) , physician (number)


Question: How many medications are prescribed for each brand?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

medication : name (text) , code (number) , brand (text) | prescribes : medication (number) , physician (number)


Question: Find the name of physicians whose position title contains the word 'senior'.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , position (text) , employeeid (number)


Question: What are the names of the physicians who have 'senior' in their titles.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

physician : name (text) , position (text) , employeeid (number)


Question: Find the patient who has the most recent undergoing treatment?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

undergoes : patient (number) , dateundergoes (time) | patient : ssn (number)


Question: Which patient is undergoing the most recent treatment?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

undergoes : patient (number) , dateundergoes (time) | patient : ssn (number)


Question: Find the names of all patients who have an undergoing treatment and are staying in room 111.

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , ssn (number) | stay : patient (number) , stayid (number) , room (number) | undergoes : patient (number) , stay (number) | room : roomnumber (number)


Question: What are the names of patients who are staying in room 111 and have an undergoing treatment?

physician : employeeid (number) , name (text) , position (text) , ssn (number) | department : departmentid (number) , name (text) , head (number) | affiliated_with : physician (number) , department (number) , primaryaffiliation (boolean) | procedures : code (number) , name (text) , cost (number) | trained_in : physician (number) , treatment (number) , certificationdate (time) , certificationexpires (time) | patient : ssn (number) , name (text) , address (text) , phone (text) , insuranceid (number) , pcp (number) | nurse : employeeid (number) , name (text) , position (text) , registered (boolean) , ssn (number) | appointment : appointmentid (number) , patient (number) , prepnurse (number) , physician (number) , start (time) , end (time) , examinationroom (text) | medication : code (number) , name (text) , brand (text) , description (text) | prescribes : physician (number) , patient (number) , medication (number) , date (time) , appointment (number) , dose (text) | block : blockfloor (number) , blockcode (number) | room : roomnumber (number) , roomtype (text) , blockfloor (number) , blockcode (number) , unavailable (boolean) | on_call : nurse (number) , blockfloor (number) , blockcode (number) , oncallstart (time) , oncallend (time) | stay : stayid (number) , patient (number) , room (number) , staystart (time) , stayend (time) | undergoes : patient (number) , procedures (number) , stay (number) , dateundergoes (time) , physician (number) , assistingnurse (number)

patient : name (text) , ssn (number) | stay : patient (number) , stayid (number) , room (number) | undergoes : patient (number) , stay (number) | room : roomnumber (number)