Font size
WorksheetsGrade 12B Midterm Exam: ERDs, EHR, and SQL
Total questions: 20
Worksheet time: 13mins
Which of the following best describes an Entity in an ERD?
A specific piece of data, such as a phone number
A unique object, such as a patient or doctor, that stores data
A connection between two attributes
A rule that enforces data integrity
What is the purpose of a primary key in an entity?
To store foreign key relationships
To uniquely identify each record in the table
To hold large amounts of data
To create duplicate records
Fill in the blank: In an ERD, a (a) represents the link between two entities.
Which of the following is an example of a one-to-many relationship in an EHR system?
A patient has multiple doctors
A hospital has multiple patients
A patient has only one medical record
A doctor has only one specialization
Match the following ERD components to their definitions:
Entity
A table that exists in the database
Relationship
A connection between two entities
Attribute
A property of an entity
Primary key
A unique identifier for a record
What is the main purpose of an EHR system?
To store digital versions of a patient’s medical history
To replace hospital staff
To diagnose illnesses
To manage hospital finances
Which of the following is NOT a typical table in an EHR database?
Patients
Appointments
Invoices
Movie Reviews
Fill in the blank: In an EHR system, the (a) table usually contains attributes like patient_id, name, date_of_birth, and contact information.
Which of the following attributes is most likely to be a foreign key in an EHR database?
patient_id in the Patients table
doctor_id in the Doctors table
patient_id in the Appointments table
name in the Patients table
Match the following EHR database tables with their expected attributes:
Patients
patient_id, name, date_of_birth
Doctors
doctor_id, name, specialty
Appointments
appointment_id, patient_id, doctor_id
Prescriptions
prescription_id, patient_id, medication
Which SQL statement is used to create a table?
ADD TABLE
CREATE TABLE
NEW TABLE
MAKE TABLE
Which of the following defines a primary key in SQL?
PRIMARY_KEY
PK
PRIMARY KEY
UNIQUE KEY
Fill in the blank: The SQL statement CREATE TABLE Patients (patient_id INT, name VARCHAR(50), PRIMARY KEY(patient_id)); creates a table where (a) is the primary key.
Which of the following is the correct way to establish a foreign key relationship between Patients and Appointments tables?
FOREIGN KEY patient_id REFERENCES Patients(patient_id);
SET FOREIGN patient_id TO Patients(patient_id);
LINK patient_id TO Patients(patient_id);
ASSIGN patient_id FOREIGN Patients(patient_id);
Match the SQL commands with their purpose:
CREATE TABLE
Defines a new table in the database
PRIMARY KEY
Uniquely identifies each record in a table
FOREIGN KEY
Establishes a relationship between two tables
INSERT INTO
Adds new records to a table
What is the correct SQL command to insert a new patient into the Patients table?
INSERT Patients VALUES ('John Doe', 30, 'Male');
ADD INTO Patients VALUES ('John Doe', 30, 'Male');
INSERT INTO Patients (name, age, gender) VALUES ('John Doe', 30, 'Male');
NEW RECORD INTO Patients VALUES ('John Doe', 30, 'Male');
Which SQL command is used to add a new appointment record that links to a patient’s ID?
INSERT INTO Appointments (appointment_id, patient_id, date) VALUES (1, 5, '2025-04-01');
NEW INTO Appointments VALUES (1, 5, '2025-04-01');
ADD RECORD INTO Appointments (1, 5, '2025-04-01');
INSERT RECORD INTO Appointments VALUES (1, 5, '2025-04-01');
Fill in the blank: In SQL, the INSERT INTO command is used to add (a) to a table.
Which of the following correctly creates a table with a foreign key relationship?
CREATE TABLE Appointments (appointment_id INT, patient_id INT, FOREIGN KEY(patient_id) REFERENCES Patients(patient_id));
MAKE TABLE Appointments (appointment_id INT, patient_id INT, LINK patient_id TO Patients(patient_id));
NEW TABLE Appointments (appointment_id INT, patient_id INT, SET patient_id FOREIGN Patients(patient_id));
TABLE CREATE Appointments (appointment_id INT, patient_id INT, FOREIGN patient_id REFERENCES Patients(patient_id));
Which SQL statement correctly defines a primary key and a foreign key in the Appointments table?
CREATE TABLE Appointments (appointment_id INT, patient_id INT, PRIMARY KEY(appointment_id), FOREIGN KEY(patient_id) REFERENCES Patients(patient_id));
CREATE TABLE Appointments (appointment_id INT, patient_id INT, PRIMARY patient_id, FOREIGN appointment_id);
TABLE Appointments (appointment_id INT, patient_id INT, PRIMARY appointment_id, FOREIGN patient_id);
MAKE TABLE Appointments (appointment_id INT, patient_id INT, PRIMARY patient_id, FOREIGN appointment_id);
