what is for foreign key ??

Answers were Sorted based on User's Feedback



what is for foreign key ??..

Answer / akhtar mohammad kalim

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.

For example, say we have two tables, a CUSTOMER table that
includes all customer data, and an ORDERS table that
includes all customer orders. The constraint here is that
all orders must be associated with a customer that is
already in the CUSTOMER table. In this case, we will place
a foreign key on the ORDERS table and have it relate to the
primary key of the CUSTOMER table. This way, we can ensure
that all orders in the ORDERS table are related to a
customer in the CUSTOMER table. In other words, the ORDERS
table cannot contain information on a customer that is not
in the CUSTOMER table.

The structure of these two tables will be as follows:

Table CUSTOMER column name characteristic
SID Primary Key
Last_Name
First_Name


Table ORDERS column name characteristic
Order_ID Primary Key
Order_Date
Customer_SID Foreign Key
Amount


In the above example, the Customer_SID column in the ORDERS
table is a foreign key pointing to the SID column in the
CUSTOMER table.

Is This Answer Correct ?    9 Yes 1 No

what is for foreign key ??..

Answer / amit kumar

Follow this lick to get answer....

http://msdn.microsoft.com/en-us/library/aa933117.aspx
http://www.1keydata.com/sql/sql-foreign-key.html

thx

Is This Answer Correct ?    3 Yes 0 No

what is for foreign key ??..

Answer / vimal

It is Reference to another table

Is This Answer Correct ?    1 Yes 0 No

what is for foreign key ??..

Answer / a.ganesh

it's reduce the repeated data in the database
.I think this is main advantage and the recode can't
directly delete from Parent Table

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

Why is normalisation important?

0 Answers  


Tell me what is log shipping?

0 Answers  


which query u can write to sql server doesn't work inbetween 7.00PM to nextday 9.00AM

5 Answers   Wipro,


Why we use trigger in sql server with example?

0 Answers  


What are information schema views?

0 Answers  






What are different types of raid levels?

0 Answers  


What is the difference between SQL notification and SQL invalidation?

0 Answers   MindCracker,


What are built in functions?

0 Answers  


Ek lifafa 10 noto se bhara hai usme 2 or 5 ke note nahi hai aur usme total 50Rs hai, to batao lifafe me kon se not kitne hia it’s a challenge thank’s

6 Answers   Broadridge,


What is the syntax for encrypting a column in SQL Server?

0 Answers   MindCracker,


what is the diffrence between Snap Shot and Transaction Replication

2 Answers   CSC,


What is self join in sql server joins?

0 Answers  


Categories