Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

I need help on how to set up my database

I want to create a school management system, my problem is: how do i break up this data into chunks. How do I relate the students and their courses.

I decide to create a many to many relationship to relate this data like this

  • Student_Courses StudentID CourseID

I dont know if this is the best solution to relate each student to their courses, because i was thinking. This will have me select same student several times into table in order to assign him to a different course.

If you know a better way to relate this data or will have the time to guide me on how create this database, Please help, for any contribution will be resourceful. Thanks

1 Answer

Steven Parker
Steven Parker
229,670 Points

If each student is (potentially) associated with more than one course, this seems like a good implementation.

I'm not sure what you mean by "select same student several times into table in order to assign him to a different course". Associating a particular student with a certain course should only require one new row added to the "Student_Courses" junction table.

If you still have trouble, it might be helpful if you posted the complete DDL for the schema. And perhaps the query code you will use with it.