wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Grade 12B Midterm Exam: ERDs, EHR, and SQL

Total questions: 20

Worksheet time: 13mins

Name
Class
Date
1.

Which of the following best describes an Entity in an ERD?

a)

A specific piece of data, such as a phone number

b)

A unique object, such as a patient or doctor, that stores data

c)

A connection between two attributes

d)

A rule that enforces data integrity

2.

What is the purpose of a primary key in an entity?

a)

To store foreign key relationships

b)

To uniquely identify each record in the table

c)

To hold large amounts of data

d)

To create duplicate records

3.

Fill in the blank: In an ERD, a (a)   represents the link between two entities.

4.

Which of the following is an example of a one-to-many relationship in an EHR system?

a)

A patient has multiple doctors

b)

A hospital has multiple patients

c)

A patient has only one medical record

d)

A doctor has only one specialization

5.

Match the following ERD components to their definitions:

a)

Entity

1.

A table that exists in the database

b)

Relationship

2.

A connection between two entities

c)

Attribute

3.

A property of an entity

d)

Primary key

4.

A unique identifier for a record

6.

What is the main purpose of an EHR system?

a)

To store digital versions of a patient’s medical history

b)

To replace hospital staff

c)

To diagnose illnesses

d)

To manage hospital finances

7.

Which of the following is NOT a typical table in an EHR database?

a)

Patients

b)

Appointments

c)

Invoices

d)

Movie Reviews

8.

Fill in the blank: In an EHR system, the (a)   table usually contains attributes like patient_id, name, date_of_birth, and contact information.

9.

Which of the following attributes is most likely to be a foreign key in an EHR database?

a)

patient_id in the Patients table

b)

doctor_id in the Doctors table

c)

patient_id in the Appointments table

d)

name in the Patients table

10.

Match the following EHR database tables with their expected attributes:

a)

Patients

1.

patient_id, name, date_of_birth

b)

Doctors

2.

doctor_id, name, specialty

c)

Appointments

3.

appointment_id, patient_id, doctor_id

d)

Prescriptions

4.

prescription_id, patient_id, medication

11.

Which SQL statement is used to create a table?

a)

ADD TABLE

b)

CREATE TABLE

c)

NEW TABLE

d)

MAKE TABLE

12.

Which of the following defines a primary key in SQL?

a)

PRIMARY_KEY

b)

PK

c)

PRIMARY KEY

d)

UNIQUE KEY

13.

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.

14.

Which of the following is the correct way to establish a foreign key relationship between Patients and Appointments tables?

a)

FOREIGN KEY patient_id REFERENCES Patients(patient_id);

b)

SET FOREIGN patient_id TO Patients(patient_id);

c)

LINK patient_id TO Patients(patient_id);

d)

ASSIGN patient_id FOREIGN Patients(patient_id);

15.

Match the SQL commands with their purpose:

a)

CREATE TABLE

1.

Defines a new table in the database

b)

PRIMARY KEY

2.

Uniquely identifies each record in a table

c)

FOREIGN KEY

3.

Establishes a relationship between two tables

d)

INSERT INTO

4.

Adds new records to a table

16.

What is the correct SQL command to insert a new patient into the Patients table?

a)

INSERT Patients VALUES ('John Doe', 30, 'Male');

b)

ADD INTO Patients VALUES ('John Doe', 30, 'Male');

c)

INSERT INTO Patients (name, age, gender) VALUES ('John Doe', 30, 'Male');

d)

NEW RECORD INTO Patients VALUES ('John Doe', 30, 'Male');

17.

Which SQL command is used to add a new appointment record that links to a patient’s ID?

a)

INSERT INTO Appointments (appointment_id, patient_id, date) VALUES (1, 5, '2025-04-01');

b)

NEW INTO Appointments VALUES (1, 5, '2025-04-01');

c)

ADD RECORD INTO Appointments (1, 5, '2025-04-01');

d)

INSERT RECORD INTO Appointments VALUES (1, 5, '2025-04-01');

18.

Fill in the blank: In SQL, the INSERT INTO command is used to add (a)   to a table.

19.

Which of the following correctly creates a table with a foreign key relationship?

a)

CREATE TABLE Appointments (appointment_id INT, patient_id INT, FOREIGN KEY(patient_id) REFERENCES Patients(patient_id));

b)

MAKE TABLE Appointments (appointment_id INT, patient_id INT, LINK patient_id TO Patients(patient_id));

c)

NEW TABLE Appointments (appointment_id INT, patient_id INT, SET patient_id FOREIGN Patients(patient_id));

d)

TABLE CREATE Appointments (appointment_id INT, patient_id INT, FOREIGN patient_id REFERENCES Patients(patient_id));

20.

Which SQL statement correctly defines a primary key and a foreign key in the Appointments table?

a)

CREATE TABLE Appointments (appointment_id INT, patient_id INT, PRIMARY KEY(appointment_id), FOREIGN KEY(patient_id) REFERENCES Patients(patient_id));

b)

CREATE TABLE Appointments (appointment_id INT, patient_id INT, PRIMARY patient_id, FOREIGN appointment_id);

c)

TABLE Appointments (appointment_id INT, patient_id INT, PRIMARY appointment_id, FOREIGN patient_id);

d)

MAKE TABLE Appointments (appointment_id INT, patient_id INT, PRIMARY patient_id, FOREIGN appointment_id);