> >> Hello sir, I know some sql syntax, so I've started from the beginning
> >> already with mysql/database design. Of course, I'm by no means even
> >> at an average level of database knowledge. But I've read several
> >> articles on using composite primary keys...mysql allows me to do
> >> that. The data I'm tracking seems like it needs composite primary
> >> keys in order to provide uniqueness to each row of data. Also, most
> >> of the tables/database examples that I've looked at seem to be using
> >> more ID numbers than dated/timed data. So, I guess what I'm getting
> >> at is trying to get advice on how I might arrange the other part of
> >> the composite key (times) so I can relate the tables together. If
> >> I'm way off, so be it.
> >> Shad
> >
> >Tables can certainly have composite primary keys. But they can not have
two
> >primary keys ,which is what you were suggesting.
>
> Just an addition: Apart from a (composite) primary key, any
> table can have other keys by adding UNIQUE indexes.
Unique Constraints would actually be what you're referring to. Although
they are mostly implemented by using some kind of index, an "index" has
no place in the SQL standard. And to keep things in par with other
database system, especially with regard to this statement:
> These can be referred to by foreign keys in any related tables.
You shouldn't talk about unique indices in this context.
> It's also possible to define a primary key on one column and a
> UNIQUE constraint (index) on one or more other columns.
--
Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com