what is primary key,unique key, foreign key? can u teach me
in simple language?

Answers were Sorted based on User's Feedback



what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / inderjeet yadav

Primary key:A key which is uniquely indetified a row in a
table and primary key can not be null.

Unique key: A key which is uniquely indetified a row in a
table and but unique key can be null.

Foreign:Primary key of the first table that refering in
second table is know as foreign of second table.

Is This Answer Correct ?    3 Yes 0 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / pappu

The primary key of a relational table uniquely identifies
each record in the table. It can either be a normal
attribute that is guaranteed to be unique (such as Social
Security Number in a table with no more than one record per
person) or it can be generated by the DBMS (such as a
globally unique identifier, or GUID, in Microsoft SQL
Server). Primary keys may consist of a single attribute or
multiple attributes in combination

a unique key can uniquely identify each row in a table,
and is closely related to the Superkey concept. A unique
key comprises a single column or a set of columns. No two
distinct rows in a table can have the same value (or
combination of values) in those columns if NULL values are
not used. Depending on its design, a table may have
arbitrarily many unique keys but at most one primary key.

Unique keys do not enforce the NOT NULL constraint in
practice. Because NULL is not an actual value (it
represents the lack of a value), when two rows are
compared, and both rows have NULL in a column, the column
values are not considered to be equal. Thus, in order for a
unique key to uniquely identify each row in a table, NULL
values must not be used, however a column defined as unique
key column allows only one null value, which in turn can
uniquely identify that row/tuple.


A foreign key is a field (or fields) that points to the
primary key of another table. The purpose of the foreign
key is to ensure referential integrity of the data. In
other words, only values that are supposed to appear in the
database are permitted.

Is This Answer Correct ?    2 Yes 0 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / rahul patil

PRIMARY key is one which uniquely identifies a row in the
table.
It does not has any null value entry.It can be formed by
using one or more fields of the table.If more fields are
used then the key is known as COMPOSITE key

Is This Answer Correct ?    6 Yes 5 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / ck

Primary key is a key which will not allow any null values.
whereas unique key which will allows null value only once.

Foreign key is a key which values should match some values
in the primary key value.

Is This Answer Correct ?    2 Yes 1 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / nitin kumar

A primary key is one which uniquely identifies a row of a
table. This key does not allow null values and duplicate
values.

A foreign key is one which identifies a set of columns in a
table or enforce link between the in two tables.

Is This Answer Correct ?    2 Yes 1 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / abdul

a key which is uniquely identified by a record is called
primary key.

primary key is that key that can uniquenly identify the
values

Is This Answer Correct ?    2 Yes 1 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / mohamed ibrahim

Primary Key :- Is a unique identify a table data,it is avoid null and duplicate value.In a table we can assign single primary key.

Unique Key :- Is same as primary key but it allow single null value and avoid duplicate value.In a table we can assign more than one no of unique key.

Foreign Key :- Is a connect two table from a single column name.

Is This Answer Correct ?    2 Yes 1 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / subin

PRIMARY KEY - is a constraint(restriction) placed on one or a group of more than one columns of a table by the database admin (who does so while creating the table) that the value(s) of this column(s) will never be duplicate ensuring that every record(row) of the table is a unique one.
# There can only be a single primary key for a table. Hence the name primary key.
# This is the key used by foreign keys of other tables
to identify a unique record of this table.
# null value cannot be given to columns of primary key as
it will not ensure uniqueness of the record.


UNIQUE KEY - is a constraint on one or group of columns that
disallows duplication of records. It differs from primary key in that
# no restrictions to number of unique keys for a table.
# depending on different database software being used
one or many records can have null values.


FOREIGN KEY - constraint placed on certain column(s) of a table ensuring that the set of value(s) in theese column(s) will uniquely identify a record in a mentioned foreign table (mentioned while defining foreign key)that should be aptly associated with this record of this table.This is achieved with the help of primary key of the foreign table.

Is This Answer Correct ?    1 Yes 0 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / fopal kanjolia

A Primary key is one or more columns in a table used to
uniquely identify each roe in the table primary key value
must not be null and must be unique across the columns

Is This Answer Correct ?    24 Yes 24 No

what is primary key,unique key, foreign key? can u teach me in simple language?..

Answer / manadithya

primary key is the key to the primary school and the
foriegn key means the key made in foriegn

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More Databases AllOther Interview Questions

What is a database call?

0 Answers  


plz suggest me the books for the preparation of NIC written exam.

4 Answers   NIC, Rolta,


How do you connect to a database?

0 Answers  


How is image stored in database?

0 Answers  


what is cardinality

3 Answers   CSC,






plz suggest me the book for preparation of NIC exam.

10 Answers   NIC,


What is the Lock Based Protocol used for?

0 Answers   Hexaware,


If we execute an query in MLOAD it's ran successfully, my questions is after successfully ran MLOAD. In error tables we can see anything there! is it possible than what are they?

3 Answers   CTS,


What is difference between clustered, non-clustered and unique index?

0 Answers   Abacus,


Is storing images in a database a good idea?

0 Answers  


What is database bounce?

0 Answers  


What is the DIF format and when we will use in teradata

0 Answers  


Categories