Entities

An entity is a table in your database. An entity looks similar to a class, however, below the name, there are three columns. Each entity has its own name and then its attributes (database fields) associated with that entity. Here is an entity with its attributes.

Each attribute has three distinct aspects:

  • Name (middle column)
  • Data type (last column)
  • Key (first column)

The datatype of your attribute corresponds with the datatypes of your DBMS. For most SQL databases, data types include:

  • Int,
  • Float,
  • Datetime,
  • Varchar,
  • Text,
  • etc.

The key will be:

  • Primary Key (abbreviated to “FK”),
  • Foreign Key (abbreviated to “PK”),
  • or both (shown as “FK,PK”)