What is difference b/w composit key n primary key and
forigion key?

Answers were Sorted based on User's Feedback



What is difference b/w composit key n primary key and forigion key?..

Answer / sathish

Assume a table contains columns
book name
author name
price

>>composite key

Having multi column primary key for a single table is known as composite key.

ex: primary composite key is book name and author name

>>primary Key

Primary key is the unique key, do not accept null value and used as a id to fetch the record from the table.

>> Foreign Key

A primary key of a table which is used as a reference key of another table..

Is This Answer Correct ?    16 Yes 0 No

What is difference b/w composit key n primary key and forigion key?..

Answer / saraswathi muthuraman

Compost key :

More than one column will be used to create compst key

SQL> create table ts_250 (a number,b number,c number,
primary key(a,c));

Table created.

here column A and column C is used to create compst key.
U can't insert null value in both columns.
Only unique combination of column A and column B value can
be inserted.

Primary key :

Key will be created on a single column in table.

SQL> create table ts_251 (a number,b number,c number,
primary key(a));

Table created.


null value cann't be inserted into column a.
oracle will create a index
only unique value can be inserted into column a.
only one primary key can be created on a table

Is This Answer Correct ?    5 Yes 0 No

What is difference b/w composit key n primary key and forigion key?..

Answer / saraswathi muthuraman

Compost key :

More than one column will be used to create compst key

SQL> create table ts_250 (a number,b number,c number,
primary key(a,c));

Table created.

here column A and column C is used to create compst key.
U can't insert null value in both columns.
Only unique combination of column A and column B value can
be inserted.

Primary key :

Key will be created on a single column in table.

SQL> create table ts_251 (a number,b number,c number,
primary key(a));

Table created.


null value cann't be inserted into column a.
oracle will create a index
only unique value can be inserted into column a.
only one primary key can be created on a table

Is This Answer Correct ?    1 Yes 0 No

What is difference b/w composit key n primary key and forigion key?..

Answer / reem

A primary key is a column which uniquely identifies the
records in a table.

A foreign key is a column (the child collumn) in a table
which has a corresponding relationship and a dependency on
another collumn (the parent collumn) that is usually in a
different table.

comosit key is more than one attribute can used as aprimary
key

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More MySQL Interview Questions

What?s the default port for MySQL Server?

4 Answers   Yahoo,


I want to find out all databases starting with ‘test’, I have access to?

0 Answers  


What is dbms in mysql?

0 Answers  


How to change the database engine in mysql?

0 Answers  


How many tables will create when we create table, what are they?

5 Answers  






How do we use % when performing a search query?

0 Answers  


What is 'mysqlimport'?

0 Answers  


What you can use regular expression for in mysql? Support your answer with an example?

0 Answers  


Use mysqldump to create a copy of the database?

2 Answers  


How do I completely remove mysql from windows?

0 Answers  


What is database engine in mysql?

0 Answers  


How do I connect to mysql database?

0 Answers  


Categories