Question
Write and execute SQL statements for the following queries:
i) List the names of doctors who joined before January 1st, 2026.
ii) List the names of all patients in alphabetical order.
iii)Find the name of every patient along with the name of their assigned doctor.
iv)List the ID of all doctors who have been assigned to more than five patients.
v) Find the total number of patients assigned to each doctor.
vi) Find the total number of doctors in the hospital.
Note: Make suitable assumptions, if any.
Answer :
Word Count : 252
____ ________ _________ ______ _________ ___ __________ _________ ___ _____.
_____ ___ ________ __________ ____ _________ ________ ________.
_______ __________ ____ _____ _______ ___ ____ _________ ____ ________ _________.
____ _______ ________ ________ ____ ____ _____ ____ ___.
_____ ______ _____ __________ _____ _______ ___ _______ ___ ___ ____ ________.
____ __________ _______ _____ ___ _______ ____ _________ _______ ________ ________.
____ __________ ____ ______ ___ ____.
____ ________ _______ __________ ______ _________ _________ ________ ________ _________.
_______ ________ ________ ____ _________ ________ __________ ______.
__________ _____ ______ _____ _________.
______ ________ _______ _____ ___ __________ __________ __________ _______ _________ ______.
_________ _________ ______ _____ _____ __________ ____.
__________ _____ ____ ____ _________ _________ _________ __________.
_______ _____ ____ ________ _____ _________ _____ __________.
___ _______ _____ ______ _______ _________ ____ ___ _____.
____ ___ _________ _______ ____ _____ _________ ____ _____.
________ ___ ______ _____ __________.
Skip in 10
Assume the following tables are used in the hospital database: Doctors(DoctorID, DoctorName, JoinDate) Patients(PatientID, PatientName, DoctorID) Sample data can be inserted for execution: ```sql CREATE TABLE Doctors ( DoctorID INT PRIMARY KEY, DoctorName VARCHAR(50), JoinDate DATE ); CREATE TABLE Patients ( PatientID INT PRIMARY KEY, PatientName VARCHAR(50), DoctorID INT, FOREIGN KEY (DoctorID) REFERENCES Doctors(DoctorID) ); ``` ```sql INSERT INTO Doctors VALUES (1, 'Dr. Sharma', '2024-05-10'), (2, 'Dr. Khan', '2025-07-15'), (3, 'Dr. Mehta', '2026-02-01'), (4, 'Dr. Roy', '2023-11-20'); INSERT INTO Patients VALUES (101, 'Amit', 1), (102, 'Bhavna', 1), (103, 'Chetan', 1), (104, 'Deepa', 1), (105, 'Esha', 1), (106, 'Farhan',
____ ______ ________ __________ ____ ____ __________.____ ________ _________ ______ _________ ___ __________ _________ ___ _____.
_____ ___ ________ __________ ____ _________ ________ ________.
_______ __________ ____ _____ _______ ___ ____ _________ ____ ________ _________.
____ _______ ________ ________ ____ ____ _____ ____ ___.
_____ ______ _____ __________ _____ _______ ___ _______ ___ ___ ____ ________.
____ __________ _______ _____ ___ _______ ____ _________ _______ ________ ________.
____ __________ ____ ______ ___ ____.
____ ________ _______ __________ ______ _________ _________ ________ ________ _________.
_______ ________ ________ ____ _________ ________ __________ ______.
__________ _____ ______ _____ _________.
______ ________ _______ _____ ___ __________ __________ __________ _______ _________ ______.
_________ _________ ______ _____ _____ __________ ____.
__________ _____ ____ ____ _________ _________ _________ __________.
_______ _____ ____ ________ _____ _________ _____ __________.
___ _______ _____ ______ _______ _________ ____ ___ _____.
____ ___ _________ _______ ____ _____ _________ ____ _____.
________ ___ ______ _____ __________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.