CH-16 Tables and Integrity Constraints PDF
CH-16 Tables and Integrity Constraints PDF
CH-16 Tables and Integrity Constraints PDF
Whenever two tables are related by a common column (or set of columns), then the related column(s) in the parent
table (or primary table) should be either declared a PRIMARY KEY or UNIQUE key and the related column(s) in the
child table (or related table) should have FOREIGN KEY constraint.
For example, if there are two tables:
Items (Itemno, Description, Price, QOH)
Orders (Orderno, Orderdate, itemno, Qty)
Both the tables are related through common column Itemno.
The column Itemno is primary key in parent table Items and it should be declared as foreign key in the child table
Orders to enforce referential integrity.
Ans. CREATE TABLE PAYMENT (Loan_number INTEGER(4) PRIMARY KEY , Payment_number VARCHAR(3) , Payment_date
DATE , Payment_amount INTEGER (8) NOT NULL) ;