Joins
Combine related tables.
- 01Admissions with patient namesmedium
For each admission, show its id, diagnosis, and the patient’s full name. Order by admission id.
- 02Admissions with attending doctorsmedium
Show each admission diagnosis beside the attending doctor’s name. Sort by admission id.
- 03Diagnoses for Toronto patientsmedium
List each diagnosis and patient city for admissions involving Toronto patients, in admission order.
- 04Admissions per doctormedium
Show each doctor’s name and number of admissions, including doctors with none. Sort by admission count, highest first.
- 05Patients with admission countsmedium
Return every patient name and their number of admissions, including patients with no admissions. Order by patient id.
- 06Cardiology patient visitsmedium
Show patient names and admission diagnoses for visits handled by Cardiology doctors, in admission order.
- 07Patient and admission datesmedium
List patient names with each admission and discharge date, ordered by admission date.
- 08List the Engineering teammedium
Show each Engineering employee name and job title, ordered by employee id.
- 09Current salary by employeemedium
Return employee names and current salaries. A NULL to_date marks the current salary. Sort by employee id.
- 10Employees and their managershard
Show each employee and their manager name, excluding top-level employees. Sort by employee id.
- 11Orders per customermedium
Show every customer id and their order count, including customers without an order. Sort by customer id.
- 12Revenue by productmedium
For each product with sales, show its name, units sold, and revenue using order item quantity times unit price. Sort by revenue descending, then product name.