Course contentsShow
← Computer Science
Lesson 1613 of 2,87237. Database Design and NormalizationFree lesson

Attributes and Domains

Identifying entity properties through attributes and understanding their value domains and constraints.

Attributes and Domains

What you'll learn: How to identify and describe the properties of entities using attributes and specify what values those attributes can hold.

What Are Attributes?

In entity-relationship modeling, attributes are the properties or characteristics that describe an entity. Think of an entity as a noun (like "Customer" or "Product") and attributes as the adjectives and details that define it.

For example, a Customer entity might have attributes like:

  • customer_id
  • first_name
  • email
  • date_of_birth
  • account_balance

Each attribute captures one piece of information about the entity.

Understanding Domains

Every attribute has a domain—the set of allowable values it can take. The domain defines both the data type and any constraints on values.

For Customer attributes above:

  • customer_id: Domain = positive integers (1, 2, 3...)
  • first_name: Domain = text strings, max 50 characters
  • email: Domain = valid email format strings
  • date_of_birth: Domain = valid dates between 1900-01-01 and today
  • account_balance: Domain = decimal numbers ≥ 0.00

Why Domains Matter

Domains enforce data integrity by preventing invalid data entry. They act as gatekeepers, ensuring that an age attribute only contains reasonable numbers (not negative values or text), or that a status field only accepts predefined values like "active," "suspended," or "closed."

Think of domains like form validation rules—they tell you what kind of input is acceptable before it enters your database.

Practical Identification

When designing entities, ask: "What properties fully describe this thing?" and "What values make sense for each property?" This leads to well-defined attributes with clear, enforceable domains.

Key Takeaway: Attributes describe entity properties, and domains define the valid values and constraints for each attribute, ensuring data quality and consistency in your database design.