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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a stored procedure and a query?

594


how do you do sql tuning?

1604


give a simple example of physical and logical data independence

2103


What is Data Modelling?

636


WHAT IS CARDINALITIES OF JOIN?

1934






Which database is best to store images?

531


Explain database partitioning. What is its importance?

680


A lowest level of security by most RDBMS is

671


How to do Data integrity testing? Who does this testing (Developer or tester)?

1618


Why merge statement is used inside the database?

638


Why do we need distributed database?

547


Explain the record term used in database.

668


List some advantages of dbms.

710


What is global database name?

551


What are the advantages of normalizing a database.

602