Consider the following relational database:
- Patient(PID, Pname, Paddress, Pgender, disease)
- Doctor(DID, Dname, Daddress, Department, salary)
- Appointment(PID, DID, time)
Write SQL syntax for the following:
- Display name and address of patients who are suffering from Tuberculosis(TB).
- Count the number of doctors working in ENT department.
- Display name of doctor who is receiving maximum salary.
A: SQL Queries for Tables: Patient, Doctor and Appointment: 71
a. Display name and address of patients who are suffering from Tuberculosis(TB).
SELECT Pname,
Paddress
FROM Patient
WHERE disease = 'Tuberculosis(TB)';
b. Count the number of doctors working in ENT department.
SELECT COUNT(DID)
FROM Doctor
WHERE Department = 'ENT';
c. Display name of doctor who is receiving maximum salary.
SELECT Dname
FROM Doctor
WHERE salary = (SELECT MAX(salary)
FROM Doctor);
Asked in Year
2019
Course
BBM
University
TU