Reply to Re: A Question of design.

Your name:

Reply:


Posted by Rik on 10/24/06 15:02

Chung Leong wrote:
> Daz napisal(a):
>> I can't use any unique keys on my table, as each user can have 'up
>> to' 3600 items, and a row is added for each item the user has, in
>> the user table. For example:
>>
>> +-----+---------+
>>> uid | item_id |
>> +-----+---------+
>>> 3 | 1 |
>>> 3 | 3 |
>>> 3 | 5 |
>>> 3 | 6 |
>>> 3 | 7 |
>>> 3 | 9 |
>>> 3 | 12 |
>>> 3 | 13 |
>>> 3 | 15 |
>>> 3 | 16 |
>> +-----+---------+
>>
>> If a row doesn't exist, then a user doesn't own the item.
>
> I'm not terribly familiar with MySQL. I think it supports multi-column
> unique constraint. So in your case, you're force the uid + item_id
> combination to be unique.

Yup, and if it's about in ID that's in another table, the InnoDB engine
supports Foreign Key constraints.

Grtz,
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация