Click here to Skip to main content
14,869,990 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi To All

I am Stuck in these Task....and I Seriously need Help as fast as possible otherwise my mentors....So Please any of u Please Help...

There are 2 Tables.....
First Table

Table Name : Student
Primary Key : Stu_Number

3 Fields Are There Stu_Number , Stu_Name , Class_Code

Second Table

Table Name : Class
Primary Key : Class_Code
Foreign Key : Stu_Number

4 Fields Are There Class_Code , Stu_Number , Course_Code , Time

The Above One is Having Many to Many Relationship and "My Task Is To Break It Into One To Many Relationship" So Which Field Can i Eliminate or Give me any Other Solutions.....
Please Help ME......
Updated 1-Apr-18 9:11am
Аslam Iqbal 6-Jul-11 12:29pm
There is no many-to-many relationship in your schema. No one can solve your problem when you can't understand what is your problem. AND NEVER ask anything about to solve your home task. PLEASE try it your self.

No one. You can never create a relationship by eliminating a field. :-)

Create additional table: Student_Class_Assignment with the key Student_Class_Assignment_Id and two foreign keys: Stu_Number and Class_Code. Replace Class_Code from Student with Student_Class_Assignment_Id, remove Stu_Number from Class. It would by much easier to show on a UML diagram. The idea is: break the many-to-many relationship between Student and Class, add a middleman object between them.

A many-to-many relationship must be broken down into multiple one-to-many relationships. In this example, each student could be in many classes and each class could have many students. Breaking down this requires adding a 'join table'. Perhaps an enrollment table?
Each student can enroll to many classes, for each class an enrollment ID is assigned.
So the student table can have the enrollment IDs as foreign keys, the enrollment table can have both the student ID and the class ID as foreign keys leaving the class table as only having course id and enrollment ID.
Patrice T 1-Apr-18 19:19pm
Too late, 7 years.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900