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
What is the candidate key used for?
Design an ETL process( batch job/script)from source to starting that u will not be dependent on the source in the near future?please elobarate details on what are things to consider.if you'd like to do a diagram that will be great.please answer it
How to do performance tunning a database in DB2 V8.2 UDB in linux
Write a query to get maximum and second maximum in oracle?
Explain database partitioning. What is its importance?
What will happen non-clustered index will be created on clustered index?
What is the difference between database and server?
Can a database table exist without a primary key?
Which three commands cause a transaction to end?
query to Compare data of two tables between two different Databases(Oracle and SQL Server) Eg., Source Database: Oracle Table: Employee Target Database : SQL Server Table : emp
What is difference between server and database?
What is the relationship that exists inside in E-R diagram?
how can you perform lookup range in lookup stage expalin in detail?
What are different types of joins used in?
What is global database name?