Attributes become fields

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

Attributes become fields

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A Student entity has the attribute yearLevel. What does it become in the Student table?
A A field (column) called yearLevel
B A new table called yearLevel
2. Which is an attribute of a Student entity?
A email
B Student
3. Which field follows the 'one fact per attribute' rule?
A firstName and lastName as two separate fields
B fullNameAndYear as one field
4. Ava Nguyen, Year 7, is stored in the Student table. What is she in database terms?
A One attribute, stored as one field (column)
B One instance of the entity, stored as one record (row)
5. You list attributes for a Student entity. Which list is suitable?
A Ava, Liam, Mia, Noah
B studentId, firstName, yearLevel, email

Match the Pairs

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

Left columnRight column
1CREATE TABLE students (firstName TEXT, yearLevel INT, email TEXT); ASELECT firstName, yearLevel, email FROM students;
2INSERT INTO students VALUES ('Ava', 9, 'ava@school.edu'); BfirstName, yearLevel, email
3Each attribute holds one fact about the entity, so a student's name, year level and email each get their own field. CField names are values from one record, not attributes. The fields should be named after the properties, such as firstName, yearLevel and email.
4To see the attributes (fields) stored for the student entity, you list them in a SELECT from its table. DTwo attributes (name and year level) are squashed into one field. Each attribute should have its own field, such as firstName and yearLevel.
5CREATE TABLE students (nameAndYear TEXT, email TEXT); EThe students entity has three attributes, so the table gets three fields: firstName, yearLevel and email.
6CREATE TABLE students (Ava TEXT, 9 INT, ava@school.edu TEXT); FOne instance of the student entity, stored as one record with a value for each field.

Definitions

attribute

Fill in the Blanks

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

1.
Student(name, _________, email)
2.
CREATE TABLE ________ ( email VARCHAR(50) );
3.
SELECT firstName, _________ FROM students;
4.
______ INTO students VALUES ('Ava', 7);
5.
SELECT _____(*) FROM students;

Spot the Error

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

Question 1
A CREATE TABLE students (
B studentId INT,
C firstNameYear VARCHAR(40),
D yearLevel INT,
E email VARCHAR(50)
F );
Question 2
A Entity: Student
B Attribute: name and year level
C Attribute: yearLevel
D Attribute: email
Question 3
A INSERT INTO students
B VALUES (1, 'Ava 7');
C SELECT * FROM students;
Question 4
A Entity: Student
B Attribute name -> field name
C Attribute email -> record
Question 5
A CREATE TABLE students (
B studentId INT,
C firstName VARCHAR(30),
D email VARCHAR(50);
E );

Answer Key

Attributes become fields
Section A: Quick Questions
Q1
A — A field (column) called yearLevel
Q2
A — email
Q3
A — firstName and lastName as two separate fields
Q4
B — One instance of the entity, stored as one record (row)
Q5
B — studentId, firstName, yearLevel, email
Section B: Match the Pairs
Q1
CREATE TABLE students (firstName TEXT, yearLevel INT, email TEXT); → The students entity has three attributes, so the table gets three fields: firstName, yearLevel and email.
Q2
INSERT INTO students VALUES ('Ava', 9, 'ava@school.edu'); → One instance of the student entity, stored as one record with a value for each field.
Q3
Each attribute holds one fact about the entity, so a student's name, year level and email each get their own field. → firstName, yearLevel, email
Q4
To see the attributes (fields) stored for the student entity, you list them in a SELECT from its table. → SELECT firstName, yearLevel, email FROM students;
Q5
CREATE TABLE students (nameAndYear TEXT, email TEXT); → Two attributes (name and year level) are squashed into one field. Each attribute should have its own field, such as firstName and yearLevel.
Q6
CREATE TABLE students (Ava TEXT, 9 INT, ava@school.edu TEXT); → Field names are values from one record, not attributes. The fields should be named after the properties, such as firstName, yearLevel and email.
Section C: Definitions
Q1
attribute — An attribute is one property of an entity, like a student's name or year level. Each attribute becomes one field (column) in the entity's table, and each instance of the entity is one record.
Section D: Fill in the Blanks
Q1
Student(name, yearLevel, email)
Q2
CREATE TABLE students ( email VARCHAR(50) );
Q3
SELECT firstName, yearLevel FROM students;
Q4
INSERT INTO students VALUES ('Ava', 7);
Q5
SELECT COUNT(*) FROM students;
Section E: Spot the Error
Q1
C — A name and a year level are two different facts, so they need two fields. Each attribute gets its own field: line 3 should be firstName VARCHAR(30), and yearLevel already has its own line.}},
Q2
B — An attribute is one property, so there should be one fact per attribute. Name and year level are separate attributes. Line 2 should be Attribute: name, and yearLevel has its own line.
Q3
B — One record needs one value for each field. 'Ava 7' squashes the name and the year level into a single field. It should be VALUES (1, 'Ava', 7);
Q4
C — Each attribute becomes a field (column) in the table, not a record. A record is one instance of the entity, such as one student. It should be Attribute email -> field email.
Q5
D — The field list stays open until the closing bracket, so the semicolon cannot go after a field. A semicolon only ends the whole statement after ');'. It should be email VARCHAR(50) with nothing after it.