0

Suppose I have this two tables;
Modules and Student

Modules has the following fields

  • Module_Code(Primary Key)

Module_Name

Student has the following fields

  • Stud_Number(primary key)

Stud_FullName

My problem is that I want to include the Stud_Number on the Modules table to make it a primary key.

Can anyone show me the right syntax to use because I have through the Documentations and still I cannot find the right syntax to use.

Best Regards
Goitse
:confused:

2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by pty
0

Suppose I have this two tables;
Modules and Student

Modules has the following fields

  • Module_Code(Primary Key)

Module_Name

Student has the following fields

  • Stud_Number(primary key)

Stud_FullName

My problem is that I want to include the Stud_Number on the Modules table to make it a primary key.

Can anyone show me the right syntax to use because I have through the Documentations and still I cannot find the right syntax to use.

Best Regards
Goitse
:confused:

Why would the student id be included in the modules table?

I assume a student may have zero, one or many modules and a module may have zero, one or many students.

What I think you need is a many to many relationship with a middle table

students ----< modules_students >---modules

modules_students would have have the columns student_id and module_id; so to add a student to a module you'd add a tuple in modules_students with the student's id and the module's id.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.