Description
Please answer all question in the file and follow all instructions.
Unformatted Attachment Preview
Purchase answer to see full attachment
Explanation & Answer
View attached explanation and answer. Let me know if you have any questions.
View attached explanation and answer. Let me know if you have any questions.
Homework Assignment IV
Problem 1:
a. ER diagram:
b. List of tables:
Doctor:
Doctor_id - this is a unique ID of a doctor (Primary key)
Doctor_Name - this is the name of a doctor
Doctor_id
Doctor_Name
1
John
2
Nancy
3
Billy
4
Max
5
Lizzy
Table creation:
CREATE TABLE Doctor (
Doctor_ID int,
Doctor_Name varchar(255),
CONSTRAINT PK_Doctor PRIMARY KEY (Doctor_ID)
);
Table Insertion:
INSERT INTO Doctor (Doctor_ID,Doctor_name) VALUES (1, 'John');
INSERT INTO Doctor (Doctor_ID,Doctor_name) VALUES (2, 'Nancy');
INSERT INTO Doctor (Doctor_ID,Doctor_name) VALUES (3, 'Billy');
INSERT INTO Doctor (Doctor_ID,Doctor_name) VALUES (4, 'Max');
INSERT INTO Doctor (Doctor_ID,Doctor_name) VALUES (5, 'Lizzy');
Table Selection:
SELECT * FROM Doctor;
Patients:
Patient_id - this is a unique ID for each patient (Primary key)
Patient_name - this is the name of the patient
Zipcode - this is the zipcode of the patient
Patient_id
Patient_name
Zipcode
101
Lily
10023
102
Stewart
10045
103
Ben
10523
104
July
17542
105
Jack
10045
106
Emily
15245
107
Hannah
10045
108
Grace
10023
Table creation:
CREATE TABLE Patients (
Pa...