suri


{ City } hyd
< Country > india
* Profession * software engineer
User No # 5696
Total Questions Posted # 0
Total Answers Posted # 2

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 102
Users Marked my Answers as Wrong # 31
Questions / { suri }
Questions Answers Category Views Company eMail




Answers / { suri }

Question { Infosys, 40609 }

what is difference between foreign key and reference key


Answer

Hi, i give the definitions with easy understand exapmles

A primary key is used to uniquely identify each row in a
table. It can either be part of the actual record itself,
or it can be an artificial field (one that has nothing to
do with the actual record).
A primary key can consist of one or more fields on a table.
When multiple fields are used as a primary key, they are
called a composite key.

EX:If we take EMP table, Empno is the primary key and in
DEPT table, Deptno is the primary keys

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

EX:In EMP table Deptno field is the foreign key because it
pointing to the Deptno in DEPT table

A Reference key is a field (or fields) that points to the
primary key of the same table

EX:In EMP table Mgr field is the Reference key because it
pointing to the Empno field in the same table

Is This Answer Correct ?    64 Yes 12 No

Question { Hewitt, 128235 }

find out the third highest salary?


Answer

Hi every body,

I give the standard format Query for this type of top most
and who are the top n people in the organization like that

If we take EMP table

Select * from EMP A where &n= (select count (distinct
(sal)) from EMP B where B.sal>A.sal)

If we give n value 1 or 2 or 3….etc then we gets top one,
top second, and top third person details.

This same query can we use top n people who are earning
maximum salaries in the Organization

Select * from EMP A where &n> (select count (distinct
(sal)) from EMP B where B.sal>A.sal)

Is This Answer Correct ?    38 Yes 19 No