Monday, March 19, 2012

Keys

hi
lets say i have table student(id,name) id =pk
table course(cno,cname)cn=pk
now iam a fresh graduate as i learned from uni if i want to get the couses that each student took i would make a table called studentcouse(id,cno) and put the two of them pk
now iam working and at work they told me to do so:studentcouse(studentcouse_serial,id,cno) studentcouse_serial=pk .but i told them that dublicate filed may occur amd they told me that we have a function that will remove dublicate.
so iam asking u if who is right me or them and if u can tell yr comments
thanx a lotWhy would you get duplicates in either? The link table either has a single col unique key (_serial) or a composite unique key (id+cno). In my eyes the _serial doesn't really serve any purpose. Perhaps they require only single col keys for some reason? But then again, what does the (_serial) actually contain?|||hi the serial is a pk for the table only
iam here just want to know what is the best way
composite keys or the serial that my co. use|||Well it's a long time since I checked up of CODDs db rule but I'm pretty sure the composite key is the purest approach. But that doesn't necessarily means it better. What is the reason they give for using the Serial column?|||they told me thats it better and as i know the db is science and i realy do not feel good to thier openion so i have asked
from my point of view is that if i have 1000000 records using thier option i must serach all recods to see if the new record i need to insert is found or not !!!!!!|||Not really, just because the primary key isn't the composite doesn't stop you having an composite index. Again though, why you bother having two indexes when you could just have one is still a bit odd.

No comments:

Post a Comment