| Lesson 4 | Diagramming entities and attributes |
| Objective | Identify conventions for diagramming entities and attributes in Crow’s Foot notation. |
Crow’s Foot (Information Engineering) notation is a compact way to show the entities in a system, their attributes, and the relationships between them. It is widely used because it maps cleanly to relational schemas and stays readable as models grow.
STUDENT, CLASS). Entity names are singular, often uppercase. A horizontal line separates the name from the attribute list.StudID).DormitoryNo referencing RESIDENCE).| = one; crow’s foot < = many.| = at least one (mandatory); circle O = zero allowed (optional).|—||—<O—|O—<EnrollmentDate, Grade). Often shown with a visual cue (e.g., distinctive corners) and a CPK that includes FKs to each parent.Below is a common Crow’s Foot format showing:
with keys identified and foreign-key origins noted.
STUDENT and CLASS using a junction table STUDENT CLASS.
StudID; DormitoryNo is an FK from RESIDENCE (not shown).ClassID; InstrID is an FK from INSTRUCTOR (not shown).(StudID, ClassID), referencing the parents; each pair is unique.STUDENT |—< STUDENT CLASS >—| CLASS.
UNIQUE constraints as needed:
-- Parent entities
CREATE TABLE student (
studid NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
student_no VARCHAR2(20) UNIQUE NOT NULL,
last_name VARCHAR2(60) NOT NULL,
first_name VARCHAR2(60) NOT NULL,
dormitoryno NUMBER, -- FK to RESIDENCE(residence_id), not shown
-- FOREIGN KEY (dormitoryno) REFERENCES residence(residence_id)
);
CREATE TABLE class (
classid NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
class_code VARCHAR2(20) UNIQUE NOT NULL,
title VARCHAR2(120) NOT NULL,
instrid NUMBER, -- FK to INSTRUCTOR(instructor_id), not shown
-- FOREIGN KEY (instrid) REFERENCES instructor(instructor_id)
);
-- Associative entity resolving M:N
CREATE TABLE student_class (
studid NUMBER NOT NULL,
classid NUMBER NOT NULL,
enrollment_dt DATE DEFAULT SYSDATE,
grade VARCHAR2(2),
CONSTRAINT pk_student_class PRIMARY KEY (studid, classid),
CONSTRAINT fk_sc_student FOREIGN KEY (studid) REFERENCES student(studid),
CONSTRAINT fk_sc_class FOREIGN KEY (classid) REFERENCES class(classid)
);
Alternative (composite keys without surrogate IDs):
CREATE TABLE student_natural (
student_no VARCHAR2(20) PRIMARY KEY,
last_name VARCHAR2(60) NOT NULL,
first_name VARCHAR2(60) NOT NULL
);
CREATE TABLE class_natural (
class_code VARCHAR2(20) PRIMARY KEY,
title VARCHAR2(120) NOT NULL
);
CREATE TABLE student_class_natural (
student_no VARCHAR2(20) NOT NULL,
class_code VARCHAR2(20) NOT NULL,
CONSTRAINT pk_sc_nat PRIMARY KEY (student_no, class_code),
CONSTRAINT fk_sc_nat_student FOREIGN KEY (student_no) REFERENCES student_natural(student_no),
CONSTRAINT fk_sc_nat_class FOREIGN KEY (class_code) REFERENCES class_natural(class_code)
);
O or | applies).UNIQUE constraints for natural identifiers when using surrogate keys.The next lesson illustrates Crow’s Foot relationship constructs in more detail (1:1, 1:N, M:N) and how to choose keys and constraints to enforce each rule.