what is the difference between primary key & foreign key?

Answer Posted / raffi.shaik

Primary key is unique
primary key is not NULL and

foreign key is NULL
foreign key reference as Primary key in another table

Primary key is unique key but foreign key always refers to
primary key

primary key is used to identify a row and it does not allow
null values. It avoids duplication of rows.

whereas foreign key refers to a column or combination of
columns included in the definition of referential integrity.

In the context of relational databases, a foreign key is a
referential constraint between two tables.[1] The foreign
key identifies a column or a set of columns in one
(referencing) table that refers to a column or set of
columns in another (referenced) table. The columns in the
referencing table must form a primary key or unique key.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can the query output be sorted by multiple columns in oracle?

570


What happens if recursive calls get out of control?

546


Explain what does a control file contain?

607


What do you mean by cdb and pdb in oracle 12c?

633


What are the different types of partitions in oracle?

494






Can we convert a date to char in oracle and if so, what would be the syntax?

548


What are the oracle built-in data types?

560


How to save query output to a local file?

556


What is clustered table in Oracle?

641


Explain what are the characteristics of data files?

625


Is there a combination of "like" and "in" in sql?

577


22. Display the order number, number of lines in the order, total number of items and total value for all orders that have a total value greater than $100

1602


How do you increase the OS limitation for open files (LINUX and/or Solaris)?

1462


I have some query regarding Report generation from Oracle Apps "PO module". I have to generate a report where table columns are as below: Vendor_name Invoice No PO Number Item_Quantity Value of Goods Date of Shipping Name_of_the_transport Date_of_receipt_issued. Now my questions is :from which table/column I can get the information of "Name_of_the_transport" column. Thanks in advance.

2886


What are the common oracle dba tasks?

620