SQL Practice

Joins

Combine related tables.

  1. 01Admissions with patient names

    For each admission, show its id, diagnosis, and the patient’s full name. Order by admission id.

    medium
  2. 02Admissions with attending doctors

    Show each admission diagnosis beside the attending doctor’s name. Sort by admission id.

    medium
  3. 03Diagnoses for Toronto patients

    List each diagnosis and patient city for admissions involving Toronto patients, in admission order.

    medium
  4. 04Admissions per doctor

    Show each doctor’s name and number of admissions, including doctors with none. Sort by admission count, highest first.

    medium
  5. 05Patients with admission counts

    Return every patient name and their number of admissions, including patients with no admissions. Order by patient id.

    medium
  6. 06Cardiology patient visits

    Show patient names and admission diagnoses for visits handled by Cardiology doctors, in admission order.

    medium
  7. 07Patient and admission dates

    List patient names with each admission and discharge date, ordered by admission date.

    medium
  8. 08List the Engineering team

    Show each Engineering employee name and job title, ordered by employee id.

    medium
  9. 09Current salary by employee

    Return employee names and current salaries. A NULL to_date marks the current salary. Sort by employee id.

    medium
  10. 10Employees and their managers

    Show each employee and their manager name, excluding top-level employees. Sort by employee id.

    hard
  11. 11Orders per customer

    Show every customer id and their order count, including customers without an order. Sort by customer id.

    medium
  12. 12Revenue by product

    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.

    medium
← All practice topics