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.
Loading

Sandeep Singh ShekhawatPosted Jun 1, 2013, 4:59 AM
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 ViswanathPosted Jun 1, 2013, 7:14 AM