You are here

Entities and Attributes

19 January, 2016 - 12:35

Review Question

What is an entity?

 

An entity is an object, event, or agent about which data are collected. As examples, objects could include such things as orders, sales, and purchases. Agents include people such as customers, employees, and vendors. Basically, an entity is anything that independently exists.

Review Question

What is an attribute?

 

In order to understand which entity we are capturing in our database and, likewise, to be able to identify that unique entity when we retrieve the data, we need to describe the entity in detail. In a data model, we describe entities by recording the essential characteristics of that entity that fully describe it. In other words, we record its attributes.An attribute is an item of data that characterizes an entity or relationship. Figure 3.8 displays an attribute hierarchy for an entity CLIENT. Notice that to describe fully a CLIENT we need to record several attributes such as Name, Address, Contact_Person, and Phone_Number. Sometimes, attributes are a combination of parts that have unique meanings of their own. For instance, in Figure 3.8, Address might consist of several independent subattributes such as the Street_Address, City, State, and Zip_Code. Attributes that consist of multiple sub-attributes are referred to as composite attributes.

Note that an inherent assumption we have made in specifying the attributes for the entity, CLIENT, is that there is a common set of attributes for each entity of interest in our database. 1 That is, for every client we need to know the client’s name, address, contact person, and phone number. To design an effective data model, you must learn to identify the complete set of entities and the common attributes that fully describe each entity. It is very important that the attributes are also sufficient to allow the user of a database to identify uniquely each entity in the database.

media/image42.png
Figure 3.8 Attribute Hierarchy for the Entity CLIENT 
 

Review Question

What is a relationship? What is a key attribute?

 

To achieve the objective of uniquely identifying each entity to be stored in our database, it is necessary that one or more attributes be identified that will always allow the user to access the entity that he or she is seeking. A key attribute is the attribute whose value is unique (i.e., different) for every entity that will ever appear in the database and is the most meaningful way of identifying each entity. This key attribute becomes the primary key. For our CLIENT entity, we might be able to use the Name for the key attribute; but alphabetic-based attributes like names are tricky because computers are sometimes sensitive to the use (or non-use) of capital letters. Further, spellings and full names can be tricky in that one user might view the company name as “Arnold Consultants” while another user might use the full name, “Arnold Consultants, LLP.” If possible, it is preferable to use a numeric-valued or a non-naming alphabetic attribute. For instance, we could use a client number that would typically be assigned to each CLIENT. A numeric form using a sequential coding scheme might assign a number such as “12345.” A non-naming alphabetic form using block coding to categorize companies by the first letter of a company’s name might assign an alphanumeric such as “A1234” for the client number.

Review Question

Why is it preferable to use a numeric-based attribute as the key attribute?

 

Figure 3.9 part (a), displays the symbols that are used to represent entities and attributes, as seen earlier in the E-R diagrams in Chapter 2. In Figure 3.9, part (b), the rectangle is accordingly used to represent the CLIENT entity. In order to map the attributes of an entity, we add oval connectors [as shown in part (a)] for each attribute. Notice in part (b) that we have added an oval for each of the attributes shown in Figure 3.8. For the composite attribute Address, we use the same oval connectors for each of the subattributes of the main attribute. Note that we have added an attribute beyond those shown in Figure 3.8—Client_Number. We have added this attribute as a key attribute, and have used an underline on the attribute name to document its selection as the key attribute.

media/image43.JPG
Figure 3.9 Developing Model Representations for Entities and Attributes