Jeffrey Kemp :
Following on from rics:\n\nCREATE TABLE supplier\n( supplier_id numeric(10) not null,\n supplier_name varchar2(50) not null,\n CONSTRAINT supplier_pk PRIMARY KEY (supplier_id),\n CONSTRAINT supplier_unique_name UNIQUE (supplier_name)\n);\n\nCREATE TABLE supplier_parts\n( supplier_id numeric(10) not null,\n part_name varchar2(50) not null,\n CONSTRAINT supplier_id_fk FOREIGN KEY (supplier_id)\n REFERENCES supplier (supplier_id) \n);\n\nCREATE TABLE silly\n( supplier_name varchar2(50),\n CONSTRAINT supplier_name_fk FOREIGN KEY (supplier_name)\n REFERENCES supplier (supplier_name) \n);\n\n\nIn the above example, supplier_pk is a Primary key. supplier_pk and supplier_unique_name are candidate keys. supplier_id_fk and supplier_name_fk are Referential Integrity constraints (or Foreign keys).",
2010-09-20T04:49:20