0% found this document useful (0 votes)
4 views1 page

SQL Medical Database Lab Task

The document outlines a SQL lab task focused on creating and managing a medical database for a hospital. It includes tasks such as creating tables for patients, doctors, appointments, and prescriptions, inserting records, and executing various queries to retrieve and manipulate data. Additionally, it requires the creation of a view and possibly a stored procedure or trigger, along with submission of SQL scripts and screenshots of outputs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

SQL Medical Database Lab Task

The document outlines a SQL lab task focused on creating and managing a medical database for a hospital. It includes tasks such as creating tables for patients, doctors, appointments, and prescriptions, inserting records, and executing various queries to retrieve and manipulate data. Additionally, it requires the creation of a view and possibly a stored procedure or trigger, along with submission of SQL scripts and screenshots of outputs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Lab Task: Medical Database

Scenario: A hospital stores patient, doctor, appointment, and prescription information. Schema
Patients(patient_id PK, name, age, gender, city)
Doctors(doctor_id PK, name, specialty)
Appointments(app_id PK, patient_id FK, doctor_id FK, app_date, status)
Prescriptions(rx_id PK, app_id FK, medicine, dosage) Tasks Create all four tables with appropriate
primary and foreign keys. Insert at least 5 records into each table. Display all patients older than 40.
Find all doctors whose specialty is 'Cardiology'. Show appointments with patient and doctor names
using JOIN. Count appointments for each doctor. List patients who have never booked an
appointment. Update the status of a selected appointment to 'Completed'. Delete a prescription by
rx_id. Create a view named ActiveAppointments showing appointments with status='Scheduled'.
Write a query to display the most prescribed medicine. Bonus: Create a stored procedure or trigger
(if supported by your DBMS). Submission: Submit SQL script, screenshots of query outputs, and a
brief explanation (1–2 pages).

You might also like