You don't need a class for that, but maybe you want one. At the database design level, I like to avoid linking tables and think of those tables as first class entities instead. So if we have
class tables for example, instead of creating a
student_class linking table to satisfy that many-to-many relationship, we could call it something like
Now, at the OOP level, we don't have to think about whether we should write something like
class.addStudent(student). Instead we can write
new Enrollment(student, class). And, if we ever decide that we need to store more data about that relationship, we don't have to deal with awkward problems that come from linking tables having extra fields (especially with respect to ORMs and so on). Since Enrollment is a first-class entity, it can have any other properties we want in addition to
If you can conceptualize the relationship between a student and a group as its own entity, it would probably be cleanest to model it that way.