What is Foreign Key?
What is the main difference between primary key and Foreign
Key ?
How Foreign Key can be defined?
Is Foreign key is used to join two or more table?

Answers were Sorted based on User's Feedback



What is Foreign Key? What is the main difference between primary key and Foreign Key ? How Foreig..

Answer / sunil kumar

Foreign key represents the relationship between two tables.
A foreign key in a table whose value is derived from the
primary key from some other table.The table in which foreign
key is defined is called a foreign table or detailed table.
The table that defines the primary key and is referenced by
the foreign table is called primary table or master table.
Difference between primary key and foreign key is that
primary key must contain a value,must not contain null
value,redundant value and foreign key can contain redundant
value.
Foreign key is defined as= create table employee(empno int
not null,empname char(40)not null,dept char(20),foreign
key(dept)references department(deptno))
Yes Foreign key is used t join two or more tables.

Is This Answer Correct ?    13 Yes 0 No

What is Foreign Key? What is the main difference between primary key and Foreign Key ? How Foreig..

Answer / amol kharat

Sunil is absolutely right.

foreign key may be null but primary key is not null, foeign
key is the reference to other table.

Foreign key is a primary key of reference table.

Is This Answer Correct ?    3 Yes 0 No

What is Foreign Key? What is the main difference between primary key and Foreign Key ? How Foreig..

Answer / balaji ganesh doddi

Foreign key is establish the relationship between two
tables.
Primary key is used to uniqly identified by the data into a
table.
The major differences are
Primary key should not contain null values and redundant
value.
Foreign key can contain redundant value.

Foreign key is a primary key of reference table.

Foreign key is defined as= create table employee(empno int
not null,empname char(40)not null,dept char(20),foreign
key(dept)references department(deptno))
Yes Foreign key is used t join two or more tables.

Is This Answer Correct ?    1 Yes 0 No

What is Foreign Key? What is the main difference between primary key and Foreign Key ? How Foreig..

Answer / guest

yes

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More MySQL Interview Questions

Write a query to fetch duplicate records from a table using mysql?

0 Answers  


How do I create a new database in mysql?

0 Answers  


Is mysql a distributed database?

0 Answers  


What, if a table has one column defined as TIMESTAMP?

0 Answers  


SQL: 1. Write a queryto retrieve the author who was published a book at the youngest age? 2. write a query to retrieve the no. of books published a each year in various languages? 3. write a query to retrieve no. of books published by them only those authors who have published more than 1 book? 4. write a query to retrieve who has not published any books during the year 2006? 5. write a query to retrieve the authors who has published any books during the birth date write this query in 2 ways 1)joins 2)sub query 6. write a query to retrieve all the books which was published during jan 2007 & title containing India or published in the language hindi? 1. table name is liberary managemnt and two column is there one is authors and another one is books . 2.four fields will comes under authours like nationality, birthdate ,first-language,second-language 3.four fields will comes under books like authour,title ,language,publish date to write query using this details

4 Answers   Covansys,






How do I rename a table in mysql?

0 Answers  


How to check if value already exists in mysql database in php?

0 Answers  


What is mysqli_result?

0 Answers  


Does uninstalling mysql delete database?

0 Answers  


What is difference between microsoft sql and mysql?

0 Answers  


Is oracle mysql free?

0 Answers  


How to execute mysql query in php?

0 Answers  


Categories