<s>
In	O
database	B-Application
design	I-Application
,	O
a	O
composite	B-Application
key	I-Application
is	O
a	O
candidate	B-Application
key	I-Application
that	O
consists	O
of	O
two	O
or	O
more	O
attributes	O
(	O
table	O
columns	O
)	O
that	O
together	O
uniquely	O
identify	O
an	O
entity	O
occurrence	O
(	O
table	O
row	O
)	O
.	O
</s>
<s>
A	O
compound	B-Application
key	I-Application
is	O
a	O
composite	B-Application
key	I-Application
for	O
which	O
each	O
attribute	O
that	O
makes	O
up	O
the	O
key	O
is	O
a	O
foreign	B-Application
key	I-Application
in	O
its	O
own	O
right	O
.	O
</s>
<s>
Composite	B-Application
keys	I-Application
have	O
advantages	O
similar	O
to	O
that	O
of	O
a	O
natural	B-Application
key	I-Application
as	O
it	O
is	O
often	O
composed	O
of	O
multiple	O
natural	B-Application
key	I-Application
attributes	O
.	O
</s>
<s>
Composite	B-Application
keys	I-Application
use	O
less	O
disk	O
space	O
as	O
compared	O
to	O
defining	O
a	O
surrogate	B-Application
key	I-Application
column	O
,	O
this	O
is	O
because	O
the	O
composite	B-Application
key	I-Application
already	O
exists	O
as	O
attributes	O
in	O
the	O
table	O
and	O
does	O
not	O
need	O
to	O
be	O
defined	O
in	O
the	O
table	O
just	O
for	O
the	O
purpose	O
of	O
unique	O
identification	O
.	O
</s>
<s>
Composite	B-Application
keys	I-Application
are	O
easy	O
to	O
implement	O
in	O
a	O
database	B-Application
schema	I-Application
as	O
their	O
component	O
parts	O
are	O
already	O
named	O
items	O
in	O
the	O
database	O
.	O
</s>
<s>
When	O
they	O
are	O
also	O
natural	B-Application
keys	I-Application
,	O
they	O
are	O
often	O
intuitive	O
for	O
real	O
world	O
scenarios	O
.	O
</s>
<s>
Composite	B-Application
keys	I-Application
are	O
formed	O
of	O
multiple	O
natural	B-Application
keys	I-Application
which	O
are	O
related	O
to	O
the	O
real	O
world	O
and	O
with	O
the	O
change	O
of	O
their	O
format	O
in	O
the	O
real	O
world	O
,	O
their	O
format	O
in	O
the	O
database	O
will	O
also	O
be	O
changed	O
.	O
</s>
<s>
This	O
is	O
inconvenient	O
as	O
the	O
number	O
of	O
attributes	O
of	O
composite	B-Application
key	I-Application
will	O
change	O
and	O
all	O
the	O
foreign	B-Application
keys	I-Application
would	O
need	O
to	O
be	O
updated	O
.	O
</s>
<s>
A	O
composite	B-Application
key	I-Application
consists	O
of	O
multiple	O
attributes	O
and	O
the	O
composite	B-Application
key	I-Application
will	O
be	O
referenced	O
in	O
multiple	O
tables	O
as	O
the	O
foreign	B-Application
key	I-Application
,	O
this	O
uses	O
a	O
lot	O
of	O
disk	O
space	O
as	O
multiple	O
columns	O
are	O
being	O
stored	O
as	O
the	O
foreign	B-Application
key	I-Application
instead	O
of	O
just	O
possibly	O
one	O
.	O
</s>
<s>
This	O
makes	O
the	O
schema	B-Application
complex	O
and	O
the	O
queries	O
become	O
more	O
CPU	O
expensive	O
as	O
for	O
every	O
join	O
the	O
DBMS	O
will	O
need	O
to	O
compare	O
three	O
attributes	O
instead	O
of	O
just	O
possibly	O
one	O
in	O
case	O
of	O
a	O
single	O
natural	B-Application
key	I-Application
.	O
</s>
<s>
The	O
entity	O
has	O
a	O
studentID	O
and	O
a	O
moduleCode	O
as	O
its	O
primary	B-Application
key	I-Application
.	O
</s>
<s>
Each	O
of	O
the	O
attributes	O
that	O
makes	O
up	O
the	O
primary	B-Application
key	I-Application
is	O
a	O
simple	O
key	O
because	O
each	O
represents	O
a	O
unique	O
reference	O
when	O
identifying	O
a	O
student	O
in	O
one	O
instance	O
and	O
a	O
module	O
in	O
the	O
other	O
,	O
so	O
this	O
key	O
is	O
a	O
compound	B-Application
key	I-Application
.	O
</s>
<s>
In	O
a	O
table	O
representing	O
students	O
our	O
primary	B-Application
key	I-Application
would	O
now	O
be	O
firstName	O
+	O
lastName	O
.	O
</s>
<s>
The	O
primary	B-Application
key	I-Application
firstName	O
+	O
lastName	O
for	O
students	O
is	O
a	O
composite	B-Application
key	I-Application
.	O
</s>
