

REFERENCES supplier(supplier_id, supplier_name) We could also create a foreign key with more than one field as in the example below: CREATE TABLE supplierĬONSTRAINT supplier_pk PRIMARY KEY (supplier_id, supplier_name) Then we've created a foreign key called fk_supplier on the products table that references the supplier table based on the supplier_id field. It consists of only one field - the supplier_id field. In this example, we've created a primary key on the supplier table called supplier_pk. column_n)ĬONSTRAINT supplier_pk PRIMARY KEY (supplier_id)
/image%2F6191257%2F20210101%2Fob_d502bc_pl-sql-developer-oracle-client-not-pro.png)
REFERENCES parent_table (column1, column2.

The syntax for creating a foreign key using a CREATE TABLE statement is: CREATE TABLE table_nameįOREIGN KEY (column1, column2.
