What is foreign key and example?



What is foreign key and example?..

Answer / Rajendra Kumar Nepane

A foreign key is a field in one table that refers to the primary key of another table. It helps establish relationships between tables in a database, ensuring data integrity by enforcing referential constraints. For example, in a 'Orders' table, an order_id (foreign key) could link to a 'Customers' table with customer_id (primary key).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is still used and not been discarded yet?

9 Answers   Oracle,


Which are sql * plus commands?

1 Answers  


How many triggers can be applied on a table?

1 Answers  


What is set transaction?

1 Answers  


How do you display "13th of November, 17 days left for month end" without hardcoding the date.

3 Answers  


What is a composite primary key?

1 Answers  


What is difference between select statement and cursor

3 Answers   JDA,


Why commit is not used in triggers?

1 Answers  


What is latest version of sql?

1 Answers  


Do triggers have restrictions on the usage of large datatypes, such as long and long raw?

1 Answers  


What data types does pl/SQL have?

3 Answers  


Write a sql select query that only returns each name only once from a table?

1 Answers  


Categories