3

I am trying to design a database relational model for an assignment. First, I design the ER diagram, and then the relational model with tables (schemas).

Here's my question: Is it possible for an entity to have only one attribute?

2
  • ERD expert Richard Barker (Barker's Notation) in his book Entity Relationship Modelling states "every entity must be uniquely identifiable and must have at least two attributes (none of which are relationships!) before you have completed your analysis." Mar 3 '20 at 23:12
  • In the book Database Design and Implementation: A Practical Introduction using Oracle SQL it states "There must be at least two attributes for an entity type. If you cannot identify any or only one attribute for the entity then you may need to consider whether, in fact, it is actually an attribute of another entity type." Mar 3 '20 at 23:26
2

Yes, but.

If an entity only has one attribute, then that attribute must serve as an identifier for the entity. Typically, if only one attribute is found for an entity in the given data stream, then another attribute is "invented" for purposes of identifying. It's often called "id", it's often an integer, and it's often populated using the autonumber feature of the database system.

When you are doing analysis, it's important to distinguish between the features that were given to you in the problem statement, and the features you added in order to make sense out of the problem.

0
0

Walter Mitty's answer is good, but I'd like to add something.

If the column contains unique values, the surrogate key (the id column) can be added only for performance reasons. But this makes little sense if the other column is small (integer, date...) and the DBMS does not organise tables by primary key (like InnoDB). Or it does, but the table is almost read-only.

For example, even performance considerations advice against adding a surrogate key, if the other column is something like year, or prime_number.

On a more theoretical note: an entity can even have zero attributes. Since all tuples and tables are unique by definition, in relational algebra exactly 2 tables exist with 0 columns: one is empty, one has 1 tuple with 0 columns. But in practice, I don't know if such tables can be created in an existing RDBMS, and I don't know if SQL standard allows this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.