Define candidate key, alternate key, composite key?
Answers were Sorted based on User's Feedback
Answer / piyush kathayat
primary key:- The attribute or combination of attributes
that uniquely identifies a row or record.
Foreign Key:- an attribute or combination of attribute in a
table whose value match a primary key in another table.
Composite key:- A primary key that consistsof two or more
attributes is known as composite key
candidate key:- is a column in a table which has the
ability to become a primary key.
Alternate Key:- Any of the candidate keys that is not part
of the primary key is called an alternate key.
Is This Answer Correct ? | 587 Yes | 62 No |
Answer / deepak v
candidate key:-A candidate key uniquely identifies the rows
in a table.there can be more than 1 candidate key in a
table, in which one should be a primary key.
alternate key:-In the candidate key the key which is not
primary key is the alternate key.
composite key:- A key formed bythe combination of 2 or more
columns is the composite key.
Is This Answer Correct ? | 122 Yes | 50 No |
Answer / kumaresan chandran
A candidate key is one that can identify each row
of a table uniquely. Generally a candidate key becomes the
primary key of the table. If the table has more than one
candidate key, one of them will become the primary key, and
the rest are called alternate keys.
A key formed by combining at least two or more
columns is called composite key.
Is This Answer Correct ? | 89 Yes | 27 No |
Answer / raju
candidate key:-A candidate key uniquely identifies the rows
in a table.there can be more than 1 candidate key in a
table, in which one should be a primary key.
alternate key:-In the candidate key the key which is not
primary key is the alternate key.
composite key:- A key formed bythe combination of 2 or more
columns is the composite key.
Is This Answer Correct ? | 52 Yes | 24 No |
Answer / p govind rao
In the relational model of databases, a candidate key of a
relation is a minimal superkey for that relation; that is,
a set of attributes such that
the relation does not have two distinct tuples with the
same values for these attributes
there is no proper subset of these attributes for which (1)
holds.
Since a relation contains no duplicate tuples, the set of
all its attributes is a superkey. It follows that every
relation will have at least one candidate key.
The candidate keys of a relation tell us all the possible
ways we can identify its tuples. As such they are an
important concept for the design database schema.
For practical reasons RDBMSs usually require that for each
relation one of its candidate keys is declared as the
primary key, which means that it is considered as the
preferred way to identify individual tuples. Foreign keys,
for example, are usually required to reference such a
primary key and not any of the other candidate keys.
The definition of candidate keys can be illustrated with
the following (abstract) example. Consider a relation
variable (relvar) R with attributes (A, B, C, D) that has
only the following two legal values r1 and r2:
r1
A B C D
a1 b1 c1 d1
a1 b2 c2 d1
a2 b1 c2 d1
r2
A B C D
a1 b1 c1 d1
a1 b2 c2 d1
a1 b1 c2 d2
Here r2 differs from r1 only in the A and D values of the
last tuple.
For r1 the following sets have the uniqueness property,
i.e., there are no two tuples in the instance with the same
values for the attributes in the set:
{A,B}, {A,C}, {B,C}, {A,B,C}, {A,B,D}, {A,C,D}, {B,C,D},
{A,B,C,D}
For r2 the uniqueness property holds for the following sets;
{B,D}, {C,D}, {B,C}, {A,B,C}, {A,B,D}, {A,C,D}, {B,C,D},
{A,B,C,D}
Since superkeys of a relvar are those sets of attributes
that have the uniqueness property for all legal values of
that relvar and because we assume that r1 and r2 are all
the legal values that R can take, we can determine the set
of superkeys of R by taking the intersection of the two
lists:
{B,C}, {A,B,C}, {A,B,D}, {A,C,D}, {B,C,D}, {A,B,C,D}
Finally we need to select those sets for which there is no
proper subset in the list, which are in this case:
{B,C}, {A,B,D}, {A,C,D}
These are indeed the candidate keys of relvar R.
We have to consider all the relations that might be
assigned to a relvar to determine whether a certain set of
attributes is a candidate key. For example, if we had
considered only r1 then we would have concluded that {A,B}
is a candidate key, which is incorrect. However, we might
be able to conclude from such a relation that a certain set
is not a candidate key, because that set does not have the
uniqueness property (example {A,D} for r1). Note that the
existence of a proper subset of a set that has the
uniqueness property cannot in general be used as evidence
that the superset is not a candidate key. In particular,
note that in the case of an empty relation, every subset of
the heading has the uniqueness property, including the
empty set.
[edit] Determining candidate keys
The previous example only illustrates the definition of
candidate key and not how these are in practice determined.
Since most relations have a large number or even infinitely
many instances it would be impossible to determine all the
sets of attributes with the uniqueness property for each
instance. Instead it is easier to consider the sets of real-
world entities that are represented by the relation and
determine which attributes of the entities uniquely
identify them. For example a relation Employee(Name,
Address, Dept) probably represents employees and these are
likely to be uniquely identified by a combination of Name
and Address which is therefore a superkey, and unless the
same holds for only Name or only Address, then this
combination is also a candidate key.
In order to determine correctly the candidate keys it is
important to determine all superkeys, which is especially
difficult if the relation represents a set of relationships
rather than a set of entities. Therefore it is often useful
to attempt to find any "forgotten" superkeys by also
determining the functional dependencies. Consider for
example the relation Marriage(Husband, Wife, Date) for
which it will trivially hold that {Husband, Wife, Date} is
a superkey. If we assume that a certain person can only
marry once on a given date then this implies the functional
dependencies {Husband,Date}→Wife and {Wife,Date}→Husband.
From this then we can derive more superkeys by applying the
following rule:
if S is a superkey and X→Y a functional dependency
then (S-Y)+X is also a superkey
where '-' is the set difference and '+' the set union. In
this case this leads to the derivation of the superkeys
{Husband, Date} and {Wife, Date}.
Is This Answer Correct ? | 16 Yes | 8 No |
Answer / shreyas joshi
Candidate key- A candidate key is defined as an attribute or
set(combination) of attributes that no 2 tuples(rows) in a
relation hold duplicate values of it.or we can say that a
candidate key is a kind of superkey, if whose subset taken
than it cannot be said as a superkey..in otherwords consider
a customer table with attributes(cust_id,cust_name,cust_street).
than candidate key is (cust_name,cust_street)(combination)
Now this is sufficient to uniquely identify an entity in a
table.But if its subset taken i.e alone cust_name or
cust_street, they individually cannot identify uniquely a
tuple or entity..IN short a candidate key is a superkey with
no super key as it subsets.
Is This Answer Correct ? | 11 Yes | 3 No |
Answer / pratik bachchuwar
candidate key: it is the no of uniquely identified column
(or attribute) in a table.
alternate key: it is simply defined as the (no of candidate
key) - (no of primary key in a table).
composite key: it is the group of primary or uniquely
identified key which again unique in other table.
Is This Answer Correct ? | 12 Yes | 9 No |
Candidate keys-> A candidate key is a combination of
attributes that can be uniquely used to identify a database
record without any extraneous data. Each table may have one
or more candidate keys. One of these candidate keys is
selected as the table primary key.
Alternate keys-> Alternate Key or Unique Key is similar to
PK ,except it accepts null Values .So that the records can
still be entered submitting null values to this attribute.
Composite keys-> compound key (also called a composite key
or concatenated key) is a key that consists of 2 or more
attributes.
A composite Key can be either Primay or Unique
Key.More then One Key columns are said to be composite keys
Is This Answer Correct ? | 9 Yes | 6 No |
Answer / manumole
Candidate key:
Candidate keys for a table includes the set of columns
which satisfies the criteria of a primary key.
Primary key : a column/combination of columns which
uniquely identifies a row and whose values are not null.
Clustered Key:when a combination of columns becomes a
primary key it is called as clustered key.
Alternate keys:the set of columns which is avialble in the
candidate keys and are not selected as primary key.
Eg:Customer table
candidate keys:{ CustomerID, MobNo(defined as not null) }
primary key: if Db designer selected as CustomerID,then
Alternate key is MobNo
Clustered key:if both combination CustomerID- MobNo is
taken as primary key,it is nothing but a clustered key
Is This Answer Correct ? | 24 Yes | 22 No |
Answer / kamal
candidte key has following character
1 it is a combition of attributes that used to identify a database record without any extraneous data.
2 it has ability to became primary key.
3 it uniquely identifies the row in a table .there can be more than one canditate key in table ,in which one should be a primary key.
Is This Answer Correct ? | 4 Yes | 2 No |
How to create an external table.
Explain about network model?
Hi my program is accesing data from two db2 databases.what is the bind card for this program to genarate plan? how to specify the two owners and two qualifiers in bind card
Can an extended stored procedure be called from inside a user-defined function?
what is architecture of your datastage project??? i came across this question many times in interviews in specific what can i answer plz help me
Explain about relational database management systems?
what is the use of foreginkey
How would you design a database for an online site, which would average a million hits a day?
When installing the datastage7.5x2 edtion iam getting aproblem i.e the cpu count is 2 but the cpu count in installation is one . how can i install in my p.c (system is dual core).
Which data type cannot be used as a parameter in a udf?
What is bit datatype and what's the information that can be stored inside a bit column?
Can you have a nested transaction?