Alter table syntax question -
I am running MySql 4.1.6 in FC-4 Linux amd it is a huge learning exercise for me! I am using O'Reilly's MYSQL Cookbook, have gone through numerous pages of the reference manual and stuff on Google but still can get the proper commands and syntax to alter the following table T1. I would like Createdate to show the date the record was crated and remain that. I would like Workdate to show the current date unless changed by the user and remain there until the next time there was a change in the record. It would be good if these dates would come up immediately without re-opening the table as it seems to do now after my best efforts [which have never been completely successful] although that may well be a problem with Navicat which I am using as a GUI? My efforts at setting up the table have all been via the mysql command line. If someone could provide an example of a working ALTER TABLE T1 . command it would be greatly appreciated. Thank you. Bob Goodwin Zuni, Virginia # uname -a Linux box3 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 athlon i386 GNU/Linux mysql select version(); +---+ | version() | +---+ | 4.1.16| +---+ 1 row in set (0.00 sec) mysql describe T1; ++--+--+-+-+ + | Field | Type | Null | Key | Default | Extra | ++--+--+-+-+ + | ID | int(6) | | PRI | NULL| auto_increment | | Createdate | timestamp| YES | | -00-00 00:00:00 | | | Lastname | varchar(75) | YES | | NULL | | | Firstname | varchar(75) | YES | | NULL | | | Address| varchar(75) | YES | | NULL | | | City | varchar(30) | YES | | NULL | | | Zip| varchar(15) | YES | | NULL | | | Area | varchar(20) | YES | | NULL | | | Tel01 | varchar(15) | YES | | NULL | | | Tel02 | varchar(15) | YES | | NULL | | | Tel03 | varchar(15) | YES | | NULL | | | Tel04 | varchar(15) | YES | | NULL | | | Category | varchar(20) | YES | | NULL | | | Workdate | timestamp| YES | | -00-00 00:00:00 | | | Notes | varchar(255) | YES | | NULL | | ++--+--+-+-+ + 15 rows in set (0.01 sec) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Alter table syntax question -
bobgoodwin wrote: I am running MySql 4.1.6 in FC-4 Linux amd it is a huge learning exercise for me! I am using O'Reilly's MYSQL Cookbook, have gone through numerous pages of the reference manual and stuff on Google but still can get the proper commands and syntax to alter the following table T1. I would like Createdate to show the date the record was crated and remain that. I would like Workdate to show the current date unless changed by the user and remain there until the next time there was a change in the record. It would be good if these dates would come up immediately without re-opening the table as it seems to do now after my best efforts [which have never been completely successful] although that may well be a problem with Navicat which I am using as a GUI? My efforts at setting up the table have all been via the mysql command line. If someone could provide an example of a working ALTER TABLE T1 . command it would be greatly appreciated. Thank you. Bob Goodwin Zuni, Virginia # uname -a Linux box3 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 athlon i386 GNU/Linux mysql select version(); +---+ | version() | +---+ | 4.1.16| +---+ 1 row in set (0.00 sec) mysql describe T1; ++--+--+-+-+ + | Field | Type | Null | Key | Default | Extra | ++--+--+-+-+ + | ID | int(6) | | PRI | NULL| auto_increment | | Createdate | timestamp| YES | | -00-00 00:00:00 | | | Lastname | varchar(75) | YES | | NULL | | | Firstname | varchar(75) | YES | | NULL | | | Address| varchar(75) | YES | | NULL | | | City | varchar(30) | YES | | NULL | | | Zip| varchar(15) | YES | | NULL | | | Area | varchar(20) | YES | | NULL | | | Tel01 | varchar(15) | YES | | NULL | | | Tel02 | varchar(15) | YES | | NULL | | | Tel03 | varchar(15) | YES | | NULL | | | Tel04 | varchar(15) | YES | | NULL | | | Category | varchar(20) | YES | | NULL | | | Workdate | timestamp| YES | | -00-00 00:00:00 | | | Notes | varchar(255) | YES | | NULL | | ++--+--+-+-+ + 15 rows in set (0.01 sec) You have Createdate and Workdate swapped. The first timestamp gets updated on every update to the record. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]