Sir,
I am doing program of 4 tables in SQL at the moment.
Abb:-Primary Key(P.K)
My tables are:- tbl_Student(P.K.studentId) tbl_Subject(P.K.subjectId), tbl_Division(P.K.divisionId) and tbl_Mark(markId).
I want studentId, subjectId and divisionId in tbl_Mark as foreign key.
pls provide the query.
Call multiple Foreign key in a table
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Jun 1, 2013, 12:59 AM EDT
ALTER TABLE tbl_Mark
ADD CONSTRAINT FK_tbl_Mark_studentId Foreign key (studentId)
References tbl_Student(studentId)
ALTER TABLE tbl_Mark
ADD CONSTRAINT FK_tbl_Mark_subjectId Foreign key (subjectId)
References tbl_Subject(subjectId)
ALTER TABLE tbl_Mark
ADD CONSTRAINT FK_tbl_Mark_divisionId Foreign key (divisionId)
References tbl_Division(divisionId)
Bineesh ViswanathRank #1,681 · 907 reputationPosted Jun 1, 2013, 3:14 AM EDT