Entity

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

Entity

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which of these is an entity a school database could store data about?
A Happy
B Student
2. In a database design, each entity becomes...
A One field
B One table
3. Which is the better name for an entity table that stores data about books?
A Book
B Books and Stuff
4. A canteen database stores data about each order a student places. Is Order an entity?
A Yes, an event can be an entity
B No, only people and objects can be entities
5. A library needs to record each person's name, phone number and email. Which of these is the entity?
A Member
B PhoneNumber

Match the Pairs

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

Left columnRight column
1CREATE TABLE student (studentId INT, firstName VARCHAR(30)); ACREATE TABLE student (studentId INT); CREATE TABLE subject (subjectId INT);
2Entity: Event (e.g. a school sports carnival) BCREATE TABLE book (bookId INT, title VARCHAR(50));
3An entity name should be a singular noun because each row is one example of it CThe entity Student becomes one table, named with a singular noun
4Each entity becomes its own table, so students and subjects need two tables DAn entity can be an event, not just a person, place or thing
5CREATE TABLE students (studentId INT); EA student's name is an attribute, not an entity. It should be a column in the student table, not its own table.
6CREATE TABLE studentName (studentId INT); FThe entity name is plural. It should be the singular noun student, because each row is one student.

Definitions

entity

Fill in the Blanks

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

1.
CREATE TABLE ____ (bookId INT, title TEXT);
2.
____________ Place (placeId INT, city TEXT);
3.
INSERT INTO _______ VALUES (1, 'Ava');
4.
SELECT firstName ____ Student;
5.
CREATE TABLE Event (_______ INT, name TEXT);

Spot the Error

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

Question 1
A -- Entity: student
B CREATE TABLE Students (
C studentId INT,
D firstName VARCHAR(30)
E );
Question 2
A -- Library entities
B CREATE TABLE Book (id INT);
C CREATE TABLE Member (id INT);
D CREATE TABLE Loan (id INT;
Question 3
A -- Each entity is one table
B CREATE Teacher TABLE (
C teacherId INT,
D name VARCHAR(30)
E );
Question 4
A -- Sport entities
B CREATE TABLE Player (id INT);
C CREATE TABLE Teams (id INT);
D CREATE TABLE Game (id INT);
Question 5
A CREATE TABLE Pet (id INT);
B INSERT INTO Pet VALUES (1);
C INSERT INTO Pet VALUES (2);
D SELECT * FROM Pets;

Answer Key

Entity
Section A: Quick Questions
Q1
B — Student
Q2
B — One table
Q3
A — Book
Q4
A — Yes, an event can be an entity
Q5
A — Member
Section B: Match the Pairs
Q1
CREATE TABLE student (studentId INT, firstName VARCHAR(30)); → The entity Student becomes one table, named with a singular noun
Q2
Entity: Event (e.g. a school sports carnival) → An entity can be an event, not just a person, place or thing
Q3
An entity name should be a singular noun because each row is one example of it → CREATE TABLE book (bookId INT, title VARCHAR(50));
Q4
Each entity becomes its own table, so students and subjects need two tables → CREATE TABLE student (studentId INT); CREATE TABLE subject (subjectId INT);
Q5
CREATE TABLE students (studentId INT); → The entity name is plural. It should be the singular noun student, because each row is one student.
Q6
CREATE TABLE studentName (studentId INT); → A student's name is an attribute, not an entity. It should be a column in the student table, not its own table.
Section C: Definitions
Q1
entity — A type of thing a database stores data about, such as a student, book or order. Each entity becomes one table, and its name is a singular noun.
Section D: Fill in the Blanks
Q1
CREATE TABLE Book (bookId INT, title TEXT);
Q2
CREATE TABLE Place (placeId INT, city TEXT);
Q3
INSERT INTO Student VALUES (1, 'Ava');
Q4
SELECT firstName FROM Student;
Q5
CREATE TABLE Event (eventId INT, name TEXT);
Section E: Spot the Error
Q1
B — Entity names are singular nouns. The table stores many students, but the entity is one type of thing, so it should be CREATE TABLE Student (
Q2
D — The closing bracket is missing. The entity table Loan should end with ) before the semicolon: CREATE TABLE Loan (id INT);
Q3
B — The keywords are in the wrong order. The Teacher entity becomes a table with CREATE TABLE Teacher (
Q4
C — Entity names are singular nouns. The entity is Team, not Teams, so it should be CREATE TABLE Team (id INT);
Q5
D — The entity was made into a table called Pet, so the query must use that same name. It should be SELECT * FROM Pet;