Write a query in SQL to obtain the names of all patients who has been undergone a procedure costing more than $5,000 and the name of that physician who has carried out primary care
- برمجة سي كيو ال sql
- 2021-09-06
- mhanasmh00489829403
الأجوبة
SELECT pt.name AS "Patient",
p.name AS "Primary Physician",
pd.cost AS "Procedure Cost"
FROM patient pt
JOIN undergoes u ON u.patient=pt.ssn
JOIN physician p ON pt.pcp=p.employeeid
JOIN PROCEDURE pd ON u.procedure=pd.code
WHERE pd.cost>5000;
Sample Output:
Patient | Primary Physician | Procedure Cost ------------+-------------------+---------------- John Smith | John Dorian | 5600 Dennis Doe | Christopher Turk | 10000 (2 rows)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال