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? 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. 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? 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? 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. 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. 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. Link to comment https://forums.phpfreaks.com/topic/219387-group-into-teams/#findComment-1137664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.