-- create a table CREATE TABLE supplier (supplier_id numeric(10), supplier_name varchar2(20), contact_name varchar2(20), CONSTRAINT pk_supplier PRIMARY KEY (supplier_id) ); -- insert some values insert into supplier values (111,'Ram', 'abc'); insert into supplier values (222,'Hari', 'def'); -- fetch some values select * from supplier; CREATE TABLE products (product_id numeric(10), supplier_id numeric(10), CONSTRAINT fk_supplier FOREIGN KEY (supplier_id) REFERENCES supplier(supplier_id) ); insert into products values(777,111); insert into products values(777,11); ----error insert into products values(777,111); ---duplicate allowed insert into products values(777,NULL);----NULL allowed insert into products values(NULL,111); Select * from products;
To embed this project on your website, copy the following code and paste it into your website's HTML: