Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001062

Re: [PHP-DB] advantages/disads of primary keys and indices? From: Manuel Lemos (mlemos <email protected>)
Date: 06/23/01

Hello Noah,

On 23-Jun-01 14:29:58, you wrote:

>Yeah the keys would be part of the first condition of the where clause...

>this table is like this:
>username | siteid | bannerid | clicks | someotherstat

>an update would be like: update tbl set clicks=clicks+1 where
>username='something' and siteid='something' and bannerid='something'

>a select would be: select clicks from tbl where username='something' and
>siteid='something' and bannerid='something'

>so knowing this, does it make sense to make primary keys out of
>username,siteid,bannerid?

Yes, you should make a single primary key with all the three fields:
username, siteid and bannerid.

Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: email protected>?subject=Re:%20[PHP-DB]%20advantages/disads%20of%20primary%20keys%20and%20indices?&replyto=904.574T1035T8964192mlemos <email protected>">mlemos <email protected>">http://phpclasses.UpperDesign.com/?user=mlemos <email protected>

--
E-mail: mlemos <email protected>
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>