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

Answer Posted / sandeep beniwal (master)

Primary key:- Primary key means main key. A primary key is
one which uniquely identifies of a table. Prrimay key does
not allow null values and duplicate values.
e.g:
empno empname status
10 dipender active
20 nisha inactive
30 vikas active
40 naveen active
Pimary key not like this:
10 dipender active
20 nisha inactive
30 vikas active
naveen active ........ (duplicate value)

Unique key:-A unique is one which uniquely identifies a row
of a table, but there is a difference like it will allow
only one duplicate values (In sql).

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 and helps making link

e.g
employee_table user_table
empID empname status userID userID empname
10 dipender active 1 1 dipender
20 nisha inactive 2 2 nisha
30 vikas active 3 3 vikas
40 naveen active 4 4 naveen

In the above relation, userID is there in employee_table
which
is a primary key of user_table. that means, userID is
refering the user_table.

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is ole db in ssis?

610


What is ole db used for?

580


How to implement database security?

535


Which is the most reliable programming language for RDBMS Relational Database Management System for Multi user applicaton. For PC application or web application ?

2028


How to do performance tunning a database in DB2 V8.2 UDB in linux

1843






How do database connections work?

495


How many indexes can be created on a table?

615


What are database connection details?

642


What is the advantage of varchar2 over char?

790


Explain data independence & its types.

587


what is the full procedure for using store procedure in informatica7.1?

1809


What is database server and how it works?

551


Hi, I want do a course in DWH Informatica Administrator and Abinito Administrator please tell me some institute in chennai and i am searching for a job,so please help me and my mail id : satty_rh@yahoo.co.in Thanks, Kumar

1575


Write a query to retrieve for many to many relationships?

567


How does database replication work?

558