You can use the module code as the PK, but if it has characters in as well, it 
may provide a few more headaches for you in the end.

Personally I stick with ID as it is easier to remember what cake is up to.

so [omitting the likes of created and modified and other details):

modules (id, title,...)
courses (id, title, level, ...)
course_modules( id, course_id, module_id)

Thus you can get all the modules in a course and visa versa.

The title in moduels and courses is the name of the module / course in this 
case.

Ady

-----Original Message-----
From: [email protected] on behalf of rtanz
Sent: Sun 7/15/2007 18:21
To: Cake PHP
Subject: database design
 

hi i am currently designing, as i can see tables should have a primary
key called id, in my case i have a table of university modules
uniquely identified by their code number, could i make code the
primary key, or should i still use id and put the code number into the
id field?





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to