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:

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.