Data completeness

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Data completeness

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A student record has a blank value in the required field 'email'. Is this data complete?
A No, a required value is missing
B Yes, the rest of the record is filled in
2. Which check finds blank required fields when data is entered?
A Range check
B Presence check
3. A school has 30 students in Year 11, but the students table holds only 27 rows. What is the completeness problem?
A Missing records
B Missing data types
4. Which field is the best choice to mark as a required field in a students table?
A middleName, because some students have one
B studentId, because every student must have one
5. A sensor logs the temperature every hour but nothing was saved between 2pm and 5pm. What is missing?
A Records for those hours
B Field names in the header

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1SELECT * FROM students WHERE lastName IS NULL; ACounts the records in the table so you can compare with how many records should be there
2SELECT COUNT(*) FROM students; BFinds student records where a required last name field is blank, so the data is incomplete
3A presence check makes sure a required field is not left blank CThree records are missing, so the data is not complete. Complete data needs a record for every student.
4A required field must always hold a value, so the database should not allow it to be missing Dif name = "" then print "Name is required"
5SELECT * FROM students WHERE house = NULL; ENULL cannot be compared with =, so this query misses the blank values. It should use IS NULL to find the missing houses.
6Roll has 30 students but the table has 27 rows. Data is complete. Femail VARCHAR(50) NOT NULL

Definitions

data completeness

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
SELECT * FROM products WHERE name IS ____;
2.
CREATE TABLE students ( firstName VARCHAR(30) ________ );
3.
if name _ "" then print "Name is required" end if
4.
SELECT _____(*) FROM students;
5.
SELECT * FROM students WHERE house IS NULL __ lastName IS NULL;

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A input email
B if email = "" then
C print "Email accepted"
D end if
Question 2
A SELECT studentId, lastName
B FROM students
C WHERE lastName = NULL;
Question 3
A missing <- 0
B for i from 2 to length(phone)
C if phone[i] = "" then
D missing <- missing + 1
E end if
F end for
Question 4
A name = input("Name: ")
B while name == "":
C print("Name is required")
D input("Name: ")
Question 5
A CREATE TABLE members (
B email VARCHAR(50) NULL,
C name VARCHAR(30) NOT NULL
D );

Answer Key

Data completeness
Section A: Quick Questions
Q1
A — No, a required value is missing
Q2
B — Presence check
Q3
A — Missing records
Q4
B — studentId, because every student must have one
Q5
A — Records for those hours
Section B: Match the Pairs
Q1
SELECT * FROM students WHERE lastName IS NULL; → Finds student records where a required last name field is blank, so the data is incomplete
Q2
SELECT COUNT(*) FROM students; → Counts the records in the table so you can compare with how many records should be there
Q3
A presence check makes sure a required field is not left blank → if name = "" then print "Name is required"
Q4
A required field must always hold a value, so the database should not allow it to be missing → email VARCHAR(50) NOT NULL
Q5
SELECT * FROM students WHERE house = NULL; → NULL cannot be compared with =, so this query misses the blank values. It should use IS NULL to find the missing houses.
Q6
Roll has 30 students but the table has 27 rows. Data is complete. → Three records are missing, so the data is not complete. Complete data needs a record for every student.
Section C: Definitions
Q1
data completeness — Data is complete when every required value is present, with no missing fields or records. A presence check finds blank required fields.
Section D: Fill in the Blanks
Q1
SELECT * FROM products WHERE name IS NULL;
Q2
CREATE TABLE students ( firstName VARCHAR(30) NOT NULL );
Q3
if name = "" then print "Name is required" end if
Q4
SELECT COUNT(*) FROM students;
Q5
SELECT * FROM students WHERE house IS NULL OR lastName IS NULL;
Section E: Spot the Error
Q1
C — A presence check finds a blank required field, so the message must tell the user the email is missing. It should print "Email is required".
Q2
C — A missing value is tested with IS NULL, not = NULL. Comparing with = NULL never matches, so no blank last names are found.
Q3
B — The loop starts at 2, so it skips the first record and its blank phone number is never counted. It should start at 1 so every record is checked.
Q4
D — The new input is not stored in name, so it stays blank and the loop never ends. It should be name = input("Name: ").
Q5
B — NULL allows the required email field to be left blank. A required field should be declared NOT NULL so the data stays complete.