Sunteți pe pagina 1din 3

Composite Keys and Composite Attributes

By: Yasmeen Shabana

BSc of Electrical Engineering and Power Machines.

MSc of Software Engineering.


__________________________________________________________________________________________

In database systems, we established the fact that a key is defined as an attribute or group of
attributes used to determine the values of other attributes. A composite key would be composed of
more than one attribute which is called key attribute. Composite keys are also called multiple
attribute keys (Coronel and Morris, 2015). A composite key is also called a compound key that
includes more than one field (Stephens, 2009). (Foster and Godbole, 2016) define composite key as a
combination of attributes that can serve as candidate keys in a relational database. Each attribute
contributes to forming the composite key is thought of as a simple key.

If the composite key is used as a primary key, all attributes comprising this composite key
must not be null for any tuple in the relation. To illustrate the concept of composite key, consider the
example shown in Fig.02. It contains employees data in a company database schema, the
combination of (EMP_FName, EMP_LName) would make a composite key that consists of two key
attributes. It can be used to specify multiple columns for a primary-key or foreign-key constraint (IBM
Knowledge Center, 2018). In our example, we created a composite primary key.

A composite attribute is an attribute that can be further subdivided to form additional


attributes (Coronel and Morris, 2015). It means a composite attribute occurs when creating an
attribute that is composed of multiple components, of which each one of them can have its
independent existence as a smaller component (Connolly and Begg, 2015). For example in Fig.02, we
notice that there are two composite attributes (EMP_ADD, EMP_Phone) that can be further
subdivided into simple attributes.

The attribute EMP_ADD can be decomposed into street, city, state, and zip code. The
attribute EMP_Phone can be further divided into area code and personal number. Deciding to use
composite attributes or further splitting them into smaller components, is dependent on the
business roles, whether it will be more meaningful to describe the entity, and the user’s
requirements and expectations of the return results when querying the database for the address of a
particular employee (Oppel, 2009).

Fig.01: Creating Employee Table.


Fig.02: Employee Table.

Composite keys are a faster way to lookup for specific data rows in the database table
(Stephens, 2009), they are particularly useful for representing M:N type of relationships to indicate
weak entities. The composite keys are displayed in an Entity-Relationship Diagram (ERD) by
underlining the name of the attributes contributing to this composite key (Coronel and Morris, 2015).
In the example shown in Fig.02, the indication of the composite primary key entities (EMP_FName,
EMP_LName) is shown in Fig.03 and Fig.04 by underlining the attribute names and demonstrated in
Fig.05 using MySQL Workbench, where those attributes are indicated with a symbol on the left-hand
side (Oracle, 2018).

Fig.03: Chen Model (Allen and Terry, 2005).

Fig.04: Crow’s Foot Model (Coronel and Morris, 2015).


Fig.05: Model using Oracle Workbench (Oracle, 2018).

REFERENCES

Allen, S. and Terry, E. (2005) Beginning Relational Data Modeling. 2nd edn. Apress.

Connolly, T. M. and Begg, C. E. (2015) Database Systems Practical Implementation Management. 6th
edn. Pearson. Available at: www.pearsonglobaleditions.com/connolly (Accessed: 22 June 2018).

Coronel, C. and Morris, S. (2015) Database Systems Design, Implementation, and Management. 11th
edn. Cengage Learning.

Foster, E. C. and Godbole, S. (2016) Database Systems: A Pragmatic Approach. 2nd edn. Apress.

IBM Knowledge Center (2018) Defining Composite Primary and Foreign Keys. Available at:
https://www.ibm.com/support/knowledgecenter/en/SSGU8G_12.1.0/com.ibm.sqls.doc/ids_sqs_053
5.htm (Accessed: 23 June 2018).

Oppel, A. J. (2009) Databases a Beginner’s Guide. New York: McGraw-Hill.

Oracle (2018) MySQL Workbench Manual. Available at: https://dev.mysql.com/doc/workbench/en/


(Accessed: 20 June 2018).

Stephens, R. (2009) Beginning Database Design Solutions. Indianapolis, IN: Wiley Pub (Wrox
Programmer to Programmer).

S-ar putea să vă placă și