1.

In a Bank's database, there are two tables 'Customer_info' and  'Transaction_Detail' as shown below :                                Customer_InfoACC_NoCust_NameCust_AddCust_cityCust_phone1001001RamVasundhraEnclaveNew Delhi 87705576741001002KavitaPunjabi BaghNew Delhi77235452331001003RajCivil LinesAllahabad98721,365761001004SohanKrishna nagarKanpur9921305453                             Transaction_DetailTrans_IDAcc_NoTransaction_TypeAmountT0011001001Credit5000T0021001002Credit10000T0031001003Debit2000T0041001004Credit6000T0051001005Credit4000(i) Is it possible to have primary key and foreign key in one table? Justify your answer.(ii) A table can have maximum how many primary keys and foreign keys?

Answer»

(i) Yes, it is possible to have primary key and foreign key column in one table. Primary key column is used to uniquely identify each record of the table, while foreign key column is used to maintain referential integrity. As in the above given table 'Transaction_Detail', Trans_Id column is a primary key column while Acc_No column may act as a foreign key column.

(ii) A table can have maximum one Primary Key. A table can have any number of foreign Keys.



Discussion

No Comment Found

Related InterviewSolutions