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_idfirst_nameemaildate_of_birthaccount_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 charactersemail: Domain = valid email format stringsdate_of_birth: Domain = valid dates between 1900-01-01 and todayaccount_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.