Entity vs. Table

From: Alan <not.me_at_uhuh.rcn.com>
Date: Tue, 08 Jun 2004 01:33:34 GMT
Message-ID: <OH8xc.13690$9g6.11946_at_nwrdny03.gnilink.net>

Entity = "Thing of interest"

The difference between a table and entity is this:

An entity is a thing of interest in the real world. It is a business construct. Actually, "entity" can be looked at two different, though almost identical ways: An entity is an _instance of the thing of interest. One employee; one automobile, one insurance policy. Entity, as referred to in our discussions, is really an Entity Set, or I guess more accurately, a definition of an entity set. But everyone just uses the term "entity" to mean "entity set", and tuple, row, or instance to mean one instance (example) of that entity set. (I believe Joe Celko prefers this way of looking at it.)I certainly do not propse using the more exact terms, as I find them to need explanation each time they are used. I'd rather stick to the simpler ones everyone is used to and sufficiently confused about anyway.

But back to the difference between an entity and a table - Briefly(?): An entity is a thing of interest in the real world. A table is a collection of rows and columns that contain data about the entity (set). An entity is used on an Entity Relationship Diagram (ERD) to explain the realtionships among the data. An EMPLOYEE works_for a DEPARTMENT (works_for is the relationship). A CUSTOMER purchases ITEMS. ITEMS make_up an ORDER.

There is not necessarily a one-to-one relationship between entities and tables. In fact, there is a set of rules (discussed in excrutiating detail in Elmasri) to convert an ERD to a relational schema (tables).

For one simple example, in a 1:N relationship on an ERD (and participation constraints not accounted for)- You take the PK of the 1 side, and use it as an FK in the N side table. This FK is not normally an attribute of the entity on the N side.

HTH Received on Tue Jun 08 2004 - 03:33:34 CEST

Original text of this message