Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have 5 tables, Portal, Student, Employment, Business, and Dependant. Portal is connected to Student, Employment, and Business. And these three are connected to the

I have 5 tables, Portal, Student, Employment, Business, and Dependant. Portal is connected to Student, Employment, and Business.

And these three are connected to the dependant. According to the rule where the foreign key clause should be in the child table, I wrote the below SQL code.

When I write only one foreign key line (FOREIGN KEY (Guardian_ApplicationID) REFERENCES Student(Student_Application_ID)) in the dependant table data gets successfully loaded but for multiple foreign keys, it doesn't. I want dependant to have 3 foreign keys as it is attached to three tables. Please suggest what's wrong in my code.

create table Portal( Application_ID int NOT NULL, Applicant_name varchar(30) NOT NULL, Login_Info varchar(30), Visa_Type varchar(255), Application_fee int, Primary Key (Application_ID));

create table Student( Student_Application_ID int Not Null, University_Admit varchar(10) NOT NULL, Funds varchar(10), Visa_Type varchar(255), Dependant_ID int, Primary Key (Student_Application_ID), FOREIGN KEY (Student_Application_ID) REFERENCES Portal(Application_ID));

create table Business( Business_Application_ID int Not Null, Approval_letter varchar(10) NOT NULL, Business_info varchar(20), Visa_Type varchar(255), Dependant_ID int, Primary Key (Business_Application_ID), FOREIGN KEY (Business_Application_ID) REFERENCES Portal(Application_ID) );

create table Employment( Employment_Application_ID int Not Null, Employment_verification varchar(10) NOT NULL, Organization_name varchar(20), Visa_Type varchar(255), Dependant_ID int, Primary Key (Employment_Application_ID), FOREIGN KEY (Employment_Application_ID) REFERENCES Portal(Application_ID)); create table Dependant( Dependant_ID int Not Null, Guardian_ApplicationID int Not Null, Visa_Type varchar(255), Primary Key (Dependant_ID), FOREIGN KEY (Guardian_ApplicationID) REFERENCES Student(Student_Application_ID), FOREIGN KEY (Guardian_ApplicationID) REFERENCES Employment(Employment_Application_ID), FOREIGN KEY (Guardian_ApplicationID) REFERENCES Business(Business_Application_ID));

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions