Course Database Design

Entities & Attributes

The Fundamentals Preview

Designing entities

An entity and its attributes

STUDENT\n├─ student_id   (PK)\n├─ full_name\n├─ email\n├─ phone\n├─ level\n├─ created_at

Attribute types

KindExampleRule
Identifierstudent_idUnique, never changes
Descriptivefull_nameReadable, human
Derivedage (from birth_date)Don't store; compute
Multivaluedphone numbers→ separate table
Compositefull address→ separate columns

Derived data

If a value can be computed from others (age from birth_date, total from quantity×price), don't store it — it will drift out of date.

Enumerated values

level: "100" | "200" | "300" | "400"\nstatus: "active" | "blocked" | "left"

A good attribute

  • Single value per row
  • Not derived from other columns
  • The right data type (int, varchar, date)
  • Meaningful name that needs no explanation
Tip: If you find yourself storing "phone1", "phone2", "phone3" columns — stop. That is a multivalued attribute crying out for a table.

This is a free preview lesson

Enroll in the Database Design to unlock every lesson, lesson PDF guides, quizzes and your certificate - and start creating your own pieces today.


Discussion