See below.

On Wed, 2001-11-14 at 14:40, Jason Wong wrote:
> The above can be re-written as:
> 
>  //En record for hvert navnedomene
>  $sql  = "CREATE TABLE domains (
>             dNbr INTEGER UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
>             dName CHAR(25) NOT NULL,
>             payPrYr SMALLINT DEFAULT 0 NOT NULL,
>             nextPayDay DATE NULL,
>             members SMALLINT DEFAULT 0 NOT NULL,
>             noPayMembers SMALLINT DEFAULT 0 NOT NULL,
>             timeChanged TIMESTAMP (14),
>             timeCreated TIMESTAMP (14),
>             INDEX domain(dName))";
> 
> Which IMHO is clearer.
> 
> [deletia]
>
> Note you probably DON'T want timeCreated to be a TIMESTAMP field as 
> everytime to update the record and do not specify a value for it, it's 
> value will be changed to the time at which the record was updated. You 
> should probably be using a DATETIME field for this.
> 
> If you're using a timestamp field then there is no need to specify a 
> value for it when using INSERT, UPDATE or REPLACE.

That's not entirely true. If there are multiple TIMESTAMP columns in a
table, MYSQL will only update the first TIMESTAMP column it finds with
the current date/time when INSERT-ing or UPDATE-ing. Other TIMESTAMP
columns are left unchanged. Given the table structure above, only the
timeChanged field will be updated, which I believe is the intended
behavior.

HTH,
--
coop


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to