On Tue, Nov 09, 2004 at 01:37:44PM +0000, Matt Parker wrote:
My unique key is the combination of date (the date of the transaction) and the transaction description. This means that there can be the same transaction on different dates, e.g. if I buy some stamps on two different dates the description can be 'Stamps' for both of them. The advantage is that I am protected against entering the same transaction twice by mistake as this will transgress the unique key requirement. If I really *did* buy stamps twice on the same day then I just put 'Stamps again' or some such.
I don't know about mySQL (not a fan really) but in most "commercial" RDBMSs you would actually set multiple primary keys to achieve this, rather than multiple unique constraints.
Yes, I'm familiar with Oracle SQL at work.
It may just be my quick skim of the mySql (and other) documentation hasn't made clear (to me!) that they're saying the same as you.
However, does having multiple primary keys mean that the combination of the primary key columns is guaranteed to be unique? Ah, yes it does, I've just looked it up in my Oracle book on my desk here.