JimboUK Posted November 21, 2010 Share Posted November 21, 2010 Hi guys, really enjoying SQL here on my course using Java, servlets and JSP. I have a table 'students' with the following: 'studentID', 'forename', 'surname', 'courseCode', 'dob'. I need to be able to group these students into teams. Could you help me out with the logic behind it? Do I have to create a new table named 'teams', create a new column in both students AND teams called 'teamID', linking as FOREIGN KEY, and then join them together? I need to be able to create a new team using html form / jsp / servlet (no problem), but then how would I add students from the 'students' table, or remove them. What am I looking at doing? Quote Link to comment https://forums.phpfreaks.com/topic/219387-group-into-teams/ Share on other sites More sharing options...
fenway Posted November 21, 2010 Share Posted November 21, 2010 Do I have to create a new table named 'teams', create a new column in both students AND teams called 'teamID', linking as FOREIGN KEY, and then join them together? Yes, that's the proper procedure. Quote Link to comment https://forums.phpfreaks.com/topic/219387-group-into-teams/#findComment-1137594 Share on other sites More sharing options...
JimboUK Posted November 21, 2010 Author Share Posted November 21, 2010 Thanks for the quick reply! How about adding to and from the team? Would that be changing the teamID to null or something? Quote Link to comment https://forums.phpfreaks.com/topic/219387-group-into-teams/#findComment-1137597 Share on other sites More sharing options...
fenway Posted November 21, 2010 Share Posted November 21, 2010 Adding what? Quote Link to comment https://forums.phpfreaks.com/topic/219387-group-into-teams/#findComment-1137622 Share on other sites More sharing options...
JimboUK Posted November 21, 2010 Author Share Posted November 21, 2010 Adding a student to and from a team, via a html form, then listing teams. These students also need to be able to be removed from the team they are in, so that upon next viewing the list of teams with the students in them, the recently removed student is no longer in that team. Quote Link to comment https://forums.phpfreaks.com/topic/219387-group-into-teams/#findComment-1137629 Share on other sites More sharing options...
JimboUK Posted November 21, 2010 Author Share Posted November 21, 2010 Also, I need to only allow a maximum of 4 people on the team at once. Quote Link to comment https://forums.phpfreaks.com/topic/219387-group-into-teams/#findComment-1137653 Share on other sites More sharing options...
fenway Posted November 21, 2010 Share Posted November 21, 2010 Adding a student to and from a team, via a html form, then listing teams. These students also need to be able to be removed from the team they are in, so that upon next viewing the list of teams with the students in them, the recently removed student is no longer in that team. That's as easy and adding/remove the appropriate rows from the lookup table. Also, I need to only allow a maximum of 4 people on the team at once. That's easier to handle if your application. Quote Link to comment https://forums.phpfreaks.com/topic/219387-group-into-teams/#findComment-1137664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.