Well, I am trying to build an application which allows to exchange messages between instructors and students. And I need to build a ContentProvider
class, but I have encountered a problem how to represent a many-to-many relationship between the Instructor
and Student
classes, well it's more confusion than a problem.
I know that I need to create a junction table, for example:
CREATE TABLE InstructorStudent (
Student INTEGER REFERENCES Student (student_id),
Instructor INTEGER REFERENCES Instructor (instructor_id),
PRIMARY KEY (student_id, instructor_id))
But, I have a question: is it considered a bad practice if I make the primary key of the junction table as a simple integer which automatically increments itself?
Extra question
How do I retrieve the list of students for a particular instructor, and vise versa?