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

Answer Posted / sanjeev goud

Primary key - Primary key means main key
def:- A primary key is one which uniquely identifies a row
of a table. this key does not allow null values and also
does not allow duplicate values. for ex,
empno empname salary
1 sanjeev 35000
2 rakesh 34000
3 chintoo 40000

it will not the values as follows:
1 sanjeev 35000
1 rakesh 34000
chintoo 35000

Unique key - single and main key
A unique is one which uniquely identifies a row
of a table, but there is a difference like it will not
allow duplicate values and it will any number of allow
null values(In oracle).
it allows only a single null value(In sql server 2000)

Both will function in a similar way but a slight difference
will be there. So, decalaring it as a primary key is the
best one.

foreign key - a foreign key is one which will refer to a
primary key of another table

for ex,
emp_table dept_table
empno empname salary deptno deptno deptname

In the above relation, deptno is there in emp_table which
is a primary key of dept_table. that means, deptno is
refering the dept_table.

Is This Answer Correct ?    16 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

During insert operation in Netezza Connector, if we give direct option as Yes , is there any issue?

952


What is the Difference Primary key and Unique Key

581


How many types of normalization? What is the use of it?

624


how node connect with cpu?

1671


Explain the table term used in database.

577






can any one tell me how i can start database testing mean what should be initial point and how i can write a query for listing page of any item thanks in advance

2106


Differentiate between extension & intension?

877


Differentiate between delete and truncate table?

633


What is odm database?

543


How do I manually create a database?

570


What is ole db source in ssis?

554


What is a driver in database?

557


What is database server and how it works?

557


What does specialization in DBMS mean?

656


Which Statement would you use to remove the EMPLOYEE_Id_PK PRIMARY KEY constraint and all depending constraints from the EMPLOYEE table?

700