r/DatabaseHelp • u/Gaming_Ruru • Feb 28 '18
One table relationship with 2 different table
There is an attribute in table A which tells which table will it get.
Ex:
Table A (Infos)
InfoID | Type Table B (Student)
StudentID | Name | Course |Table C (Employees)
EmployeeID | Name | Company |If type = 1 then get info in Table B(student)
InfoID | StudentID | Name | CourseElse get info in Table C(Employees)
InfoID | EmployeeID| Name | Company
1
Upvotes
View all comments
Show parent comment
1
u/ScariestofChewwies Mar 01 '18
Since this is for a homework assignment I can't give you direct answers but I can point you toward how you can answer them.
This really depends on what you are doing with it and what information you need for each operation. If you have to answer that for your project, I would examine it from a couple perspectives based on what information you need to query. So if you are searching by name, getting all the students in a course, getting all the employees for a certain company value, etc.
So what does the Type actually do for the schema? From the perspective of the database is it just there to tell you what other table to look in or are you using it for another reason.