OK, right. So as of now, each team row has a reference to a single player row. Is that what you want? There is also nothing preventing every team from having the same, single player. Again, not sounding like what the assignment wants you to do.
Perhaps the player should reference the team table? But using what? I wouldn't think the name would be a good idea... that could change. Maybe this week it's the "Juice Devils" but next week it's the "Hoover Dustbuster's Juice Devils". Now all the references from the players are bad! Damn. It would be much easier if there was some value for each team that would never, ever change.
-Lee
no there is nothing preventing every team having the same player. i will manually load data so that will not happen. I was using the pro baseball teams where the name is not likely to change. although it does happen Tampa Bay Devil Rays became the Tampa Bay Rays
Here is the assignment sheet that might answer questions.
To be clear for everyone i don't want he physical code done for me. I would like to know how to do it. I have been working on this for about 3 weeks and got almost nowhere.
Define primary key constraints for both tables to ensure entity integrity.
Define a foreign key in the child table (or the "many" end of the relationship)
to enforce referential integrity. (3 pts)
For the entity classes chosen, include all known instances, or a meaningful
subset, of the authentic data that can be collected. At least one relationship
between the "one" and the "many" tables should illustrate a participation
constraint of "1:M" (one parent row, many children), another "1:1", and "1:0".
The "many" table should contain at least 15 rows of data. (4 pts)
Invoke the following SQL commands to demonstrate your design:
1) Query each of the tables. Project all columns with rows ordered by
primary key(s); (2 pts)
2) Query your "many" (aka "child") table to list rows in order by foreign
key (major sort key) and primary key (minor key); (2 pts)
3) Issue a query with subquery (nested query) that illustrates a 1:M
relationship between one parent row and its related child rows (that is,
show child rows related to a single row from the parent table). (2 pts)
1 and 2 i can do and understand that completely
#3 i dont quite understand the nested query. The book i have say dont use nested queries but does not explain anything else about them.