sql - How do I write a create table statement for an entity that has two relationship sets attached to it? -
take picture example:
**ignore isa relationship understand concept.
my question creating table team. understand how create tables entities, , relationships i'm getting little confused how should go creating table team has 2 relationship sets being related it.
my possible solution: team holds attributes ssn(from professors) , ssn(from gtas, comes it's isa) , use primary key(profssn, gtassn) uniquely identify teams? if this, how model on_team_1 , on_team_2? thought having on_team_1 have attributes ssn(since primary key of professors) , 2 attributes such team_profssn , team_gtassn come team entity.
does sound viable or missing how this?
i think need have team table holds attributes specific team (name, least), seems need team_member table models relationship between individual , particular team. if understand data think team_member have team_name , ssn - although in euphemistically known "the real world" there's no way in hell you'd away using ssn this. example, in our systems (large international retailer) identifiable data (pid) buried deep systems, including work on, quite literally cannot see such data. suggest unless design laser-etched in titanium shouldn't use ssn - generate unique value 'person id' using sequence instead.
create table team (team_name varchar2(50) constraint pk_team primary key using index); create table team_member (team_name varchar2(50) constraint team_member_fk1 references team(team_name), person_id number, constraint pk_team_member primary key(team, person_id) using index);
best of luck.
Comments
Post a Comment