wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Higher Database Design & Development

Total questions: 25

Worksheet time: 24mins

Name
Class
Date
1.

A relational database is developed for a hospital. State which of the following are end-user requirements.

a)

The nurses must be able to count how many patients should be in each room.

b)

The doctors must be able to change the diagnosis of a patients.

c)

The database must store information about the staff, patients, rooms and appointments.

d)

A simple update query will be used to change the room that a patient occupying.

e)

A complex search query will be used to show the details of a patient's appointment by searching using their patientID and appointment date and appointment time.

2.

A relational database is developed for a hospital. State which of the following are functional requirements.

a)

The nurses must be able to to enter a new patients into the database.

b)

The receptionists must be able to add a new appointment for the patient and assign it to a doctor and room.

c)

The database must allow the patients current medication to be updated using a simple update query.

d)

A simple search query will be used with wildcards to allow the user to search for a patient using just the first letter of their surname.

e)

A complex search query will be used to show the details of a patient's appointment by searching using their patientID and appointment date and appointment time.

3.

State the cardinality between the two table shown in the Entity Occurrence Diagram

a)

One to one

b)

One to Many

c)

Many to Many

4.

State the cardinality between the two table shown in the Entity Occurrence Diagram

a)

One to one

b)

One to Many

c)

Many to Many

5.

State the cardinality between the two table shown in the Entity Occurrence Diagram

a)

One to one

b)

One to Many

c)

Many to Many

6.

State which of the following Entity Occurrence Diagrams correctly demonstrate some or all of the relationships between the entities in the Entity Relationship Diagram shown.

a)

b)

c)

d)

7.

State the purpose of a compound key.

a)

To join multiple fields together to create a unique combination of data that can be used in place of a primary key.

b)

An aggregate function that is used to calculate compounding interest in a financial database.

c)

Used in conjunction with the primary key to create a unique identifier for each record.

d)

Used in encryption to decrypt and encrypt plain text messages.

8.

Using the image provided, state a suitable compound key.

a)

StudentID + CourseID

b)

CourseID + EnrollmentDate

c)

StudentID + CourseID + ExamDate

d)

ExamDate + ExamTime

9.

The data dictionary shown is used to store the details of when an employee is working in a shop. State the errors with this data dictionary.

a)

Wrong Primary Key

b)

Should use a Compound Key

c)

Validation missing condition on Department field

d)

Incorrect data types

e)

Sizes are incorrect

10.

State any errors that are present in the data dictionary shown.

a)

Birthday should have a length check

b)

The entity should have a compound key

c)

The field EmployeeID should not have a presence check

d)

StoreID should have referential integrity applied to it in the validation

e)

There are no errors

11.

State which of the following is an example of a length check.

a)

len([userID]) = 10

b)

= 10

c)

userID = len(10)

d)

== 10

12.

In a data dictionary, describe the purpose of the attribute size column.

a)

The attribute size column is used to identify the maximum number of characters allow for a textual value.

b)

The attribute size column is used to define the exact length of data stored in a text data type must be.

c)

The attribute size column is used to state the maximum size of each field being stored in an entity.

d)

The attribute size column is used to define the actual storage, in bytes, that will be used to store any data stored in the field per record.

13.

Describe the purpose of a wildcard.

a)

A wildcard is used in the WHERE clause to create a condition that allows placeholder letters.

b)

A wildcard let's the use enter any letter or number to fill in a space of the data.

c)

As the user types in some data the computer using wildcards will display some possible options to choose from.

d)

The wildcard is a special type of query that allows the user to change zero, one or many letters in a text value.

14.

State which of the following WHERE clauses would display records which contain the word "and" (not as part of any other word) in their category.

a)

WHERE category LIKE "* and *"

b)

WHERE category LIKE "% and %"

c)

WHERE category LIKE "?and?"

d)

WHERE category LIKE "_and_"

e)

WHERE category CONTAINS "and"

15.

State which of the following are not an aggregate function.

a)

AVG()

b)

price * quantity

c)

MIN() AS [Minimum Price]

d)

LIKE "A*"

e)

GROUP BY itemCODE

16.

State which of the following are an aggregate function.

a)

MAX(price) AS [Maxiumum Price]

b)

price * quantity

c)

COUNT(*) AS [Number of Items]

d)

surname LIKE "A*"

e)

GROUP BY itemCODE

17.

Describe purpose of calculated values.

a)

To carry out arithmetic on the data stored in fields to be displayed in the results table.

b)

To carry out arithmetic on the data stored in fields to update the values that are stored in the database entity.

c)

To calculate the result of an aggregate function.

d)

To calculate string operations on the values stored in the database records.

18.

Describe the purpose of an alias.

a)

An alias is used to give a name to or rename a column in the results table of an SQL query.

b)

An alias is used to change the name of a field in the database table.

c)

An alias is used to change the name of any values that are used in the GROUP BY clause.

d)

An alias is used to add a heading to the whole results table so the user knows what the results are for.

19.

Describe the purpose of the GROUP BY clause.

a)

GROUP BY groups records together that have the same value in the given field. This allows an aggregate function to be used on subsets of data individually rather than the whole set of data.

b)

The GROUP BY let's the user specify where to find the data in the database.

c)

The GROUP BY clause allows the user to categorise the records in the results table.

d)

A GROUP BY is used when the user is using non-aggregate functions to allow them to be displayed even though they don't have an aggregate function.

20.

State whether this SQL query will execute correctly.

SELECT category, COUNT(category) AS [Number of Items]

FROM Items

a)

Yes

b)

No

21.

Describe the expected output of the following SQL Query.


SELECT DirectorName, AVG(duration) AS [Average Movie Duration]

FROM Movies

GROUP BY DirectorName

ORDER BY AVG(duration) DESC

a)

It will display a list of directors with the average length of their movies. The directors will be shown from largest average length to smallest average length.

b)

It will display the average duration of all the movies with the director who's average was the closest to the total average of all the movies. The directors will be displayed from largest total average to smallest total average.

c)

It will display the average duration of the specified director. The directors will be shown from largest average length to smallest average length.

d)

It will display only the directors names from smallest duration to largest duration.

22.

State which of the following SQL queries will display the year that each directors first movie was released.

a)

SELECT name, MIN(yearReleased) AS [Year of First Movie]

FROM Movie

GROUP BY name

b)

SELECT name, MAX(yearReleased) AS [Year of First Movie]

FROM Movie

GROUP BY name

c)

SELECT name, MIN(yearReleased) AS [Year of First Movie]

FROM Movie

GROUP BY yearReleased

d)

SELECT name, MAX(yearReleased) AS [Year of First Movie]

FROM Movie

GROUP BY yearReleased

23.

Using the sample data shown, Select the output of the following SQL Query:

SELECT Type, MIN(price) AS ‘Least expensive item’

FROM Electronics

WHERE Quantity >= 10

GROUP BY Type;

a)
b)
c)
d)
24.

State which of the following SQL Statements would produce the results shown for all full time employees.

a)

SELECT Department, SUM(salary) AS [Salary Cost]

FROM Staff

WHERE partTime = false

GROUP BY Department;

b)

SELECT Department, COUNT(salary) AS [Salary Cost]

FROM Staff

WHERE partTime = false

GROUP BY Department;

c)

SELECT Department, SUM(salary)

FROM Staff

WHERE partTime = false

GROUP BY Department;

d)

SELECT Department, SUM(salary)

FROM Staff

ORDER BY SUM(salary) DESC

GROUP BY Department;

25.

Select of the following results would be generated from the SQL Queries shown.

a)
b)
c)
d)