Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop a Python interface for your SQL database. Include a menu to search, update, and view reports. CREATE SCHEMA healthcare; use healthcare; CREATE TABLE Patient
Develop a Python interface for your SQL database. Include a menu to search, update, and view reports.
CREATE SCHEMA healthcare;
use healthcare;
CREATE TABLE Patient
PatientID INT PRIMARY KEY,
PatientName VARCHAR NOT NULL,
PatientAddress VARCHAR NOT NULL,
Contact VARCHAR NOT NULL,
Insurance VARCHAR NOT NULL
;
CREATE TABLE Doctor
DoctorID INT PRIMARY KEY,
Name VARCHAR NOT NULL,
Specialization VARCHAR NOT NULL,
Contact VARCHAR NOT NULL
;
CREATE TABLE Appointment
RecordID INT PRIMARY KEY,
PatientID INT,
DoctorID INT,
Date DATETIME NOT NULL,
FOREIGN KEY PatientID REFERENCES PatientPatientID
FOREIGN KEY DoctorID REFERENCES DoctorDoctorID
;
CREATE TABLE MedicalRecord
RecordID INT PRIMARY KEY,
PatientID INT,
Diagnosis VARCHAR NOT NULL,
Treatment VARCHAR NOT NULL,
FOREIGN KEY PatientID REFERENCES PatientPatientID
;
CREATE TABLE Billing
BillingID INT PRIMARY KEY,
RecordID INT,
PatientID INT,
TotalAmount DECIMAL NOT NULL,
PaymentStatus VARCHAR NOT NULL,
FOREIGN KEY RecordID REFERENCES MedicalRecordRecordID
FOREIGN KEY PatientID REFERENCES PatientPatientID
;
ALTER TABLE MedicalRecord
ADD CONSTRAINT FKMedicalRecordAppointment
FOREIGN KEY RecordID
REFERENCES AppointmentRecordID;
INSERT INTO Patient PatientID PatientName, PatientAddress, Contact, Insurance
VALUES
'John Doe', Main St Anytown, CA 'Aetna'
'Jane Smith', Elm St Anytown, CA 'Blue Cross Blue
Shield'
'Mike Jones', Oak St Anytown, CA 'Cigna'
'Alice Lee', Cedar St Anytown, CA
'UnitedHealthcare'
'Bob Brown', Walnut St Anytown, CA 'Humana';
INSERT INTO Doctor DoctorID Name, Specialization, Contact
VALUES
Dr Smith', 'General Medicine',
Dr Jones', 'Cardiology',
Dr Lee', 'Dermatology',
Dr Brown', 'Neurology',
Dr Williams', 'Orthopedics', ;
INSERT INTO Appointment RecordID PatientID DoctorID Date
VALUES
;
INSERT INTO MedicalRecord RecordID PatientID Diagnosis, Treatment
VALUES
'Hypertension', 'Medications, lifestyle changes'
'Eczema', 'Topical steroids, emollients'
'Anxiety', 'Therapy, medication'
'Migraine headaches', 'Pain medication, preventive medication'
'Knee pain', 'Physical therapy, pain medication';
INSERT INTO Billing BillingID RecordID PatientID TotalAmount, PaymentStatus
VALUES
'Paid'
'Paid'
'Paid'
'Paid'
'Paid'
'Paid'
'Paid'
'Paid';
SELECT FROM Patient;
SELECT FROM Patient WHERE PatientAddress LIKE Anytown, CA;
SELECT FROM Patient WHERE Insurance 'Blue Cross Blue Shield';
UPDATE Doctor SET Name Dr Johnson' WHERE DoctorID ;
UPDATE Doctor SET Contact WHERE DoctorID ;
UPDATE Doctor SET Specialization 'Cardiology' WHERE DoctorID ;
INSERT INTO Appointment RecordID PatientID DoctorID Date
VALUES
;
SELECT Patient.PatientName, SUMBillingTotalAmount AS TotalBilling
FROM Patient
JOIN MedicalRecord ON Patient.PatientID MedicalRecord.PatientID
JOIN Billing ON MedicalRecord.RecordID Billing.RecordID
WHERE Patient.PatientID ;
SHOW INDEX FROM Doctor;
SHOW INDEX FROM Appointment;
SHOW INDEX FROM Billing;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started