Defining Entities and Attributes in Data Modeling
Learn to translate business requirements into structured database entities and attributes. Master data modeling to build a rock-solid foundation for your SaaS.
Previously in this course, we explored Introduction to Database Design: Schema Basics for SaaS and learned how to perform Requirements Gathering for SaaS: Identifying Core Entities to extract the nouns that drive our business. Now, we move from identifying these concepts to defining their technical shape.
In this lesson, we will formalize those "nouns" into entities and flesh them out with attributes, ensuring every piece of data has a clear purpose and a defined type.
From Concepts to Data Modeling
In data modeling, an entity is a person, place, object, or event about which we want to store data. If your SaaS project involves users signing up and paying for a service, "User" and "Subscription" are your primary entities.
Attributes are the specific details that describe an entity. If "User" is the entity, its attributes might be email, first_name, and created_at. Think of the entity as the table and the attributes as the columns in a spreadsheet or database.
Categorizing Attributes by Data Type
Before we write a single line of SQL, we must decide what kind of data each attribute holds. Choosing the right data type is the difference between a performant database and one that crashes under pressure.
| Category | Data Type Examples | Usage |
|---|---|---|
| Numeric | INTEGER, DECIMAL, NUMERIC | Counts, prices, IDs, quantities. |
| String | VARCHAR, TEXT | Names, emails, descriptions. |
| Temporal | TIMESTAMP, DATE, INTERVAL | Signup dates, transaction times. |
| Boolean | BOOLEAN | Flags (e.g., is_active). |
Worked Example: Modeling the SaaS User
Let’s apply this to our running project. We need to store information about our SaaS users. Based on our requirements, here is how we define the User entity and its attributes:
- Entity:
User - Attributes:
user_id: Unique identifier (Numeric)email: User's login address (String)password_hash: Securely stored password (String)is_active: Status flag (Boolean)created_at: Date/time of account creation (Temporal)
Practice Exercise
Take the "Subscription" entity from your own project requirements. List at least four attributes for it, assign them a logical data type, and explain why you chose that type.
Example:
plan_name(String): To store descriptive names like "Pro" or "Enterprise."monthly_price(Decimal): To handle currency accurately without rounding errors common in floats.
Common Pitfalls in Schema Design
Even experienced engineers fall into these traps when defining attributes:
- Over-normalizing or "Under-typing": Storing everything as a
TEXTstring is a lazy habit that prevents the database from performing math or date-based filtering efficiently. - Mixing Concerns: Including attributes that don't belong to the entity. For example, putting
shipping_addressin theUsertable is a mistake if a user might have multiple addresses; that should be a separate entity. - Ignoring Precision: Using
FLOATfor financial data. Always useDECIMALorNUMERICto avoid floating-point math errors that cause pennies to vanish from your billing reports.
FAQ: Entity and Attribute Best Practices
Q: Should I use abbreviations for attribute names?
A: Keep names descriptive and readable. user_email is better than ue. Consistency is more important than brevity.
Q: How do I handle optional data?
A: If an attribute isn't mandatory (e.g., middle_name), it simply becomes a "nullable" attribute during the physical design phase.
Q: Can an attribute be an entity itself?
A: If an attribute starts to require its own attributes (like an address that needs street, city, and zip), it is often a sign that it should be promoted to its own entity linked by a relationship.
Recap
We have moved from abstract business requirements to concrete entity definitions. We now know that entities represent our core objects, while attributes define the specific details we track. By categorizing these attributes into numeric, string, temporal, or boolean types, we prepare ourselves to build a schema that is both performant and accurate.
Up next: Understanding Relationships — we will learn how to connect these entities to make your data model truly relational.
Work with me

Laravel SaaS MVP & Multi-Tenant App Development
Launch your SaaS MVP on Laravel — multi-tenant, subscription-ready, and built by the engineer behind a platform serving 10,000+ paying users.

Custom WordPress Plugin Development
Custom WordPress & WooCommerce plugins built to standard — by the developer behind a plugin with 5,000+ active installs and a SaaS with 10,000+ users.
