[PLUG] Here is a simple MySQL question

Rich Shepard rshepard at appl-ecosys.com
Thu Dec 21 00:21:51 UTC 2006


On Wed, 20 Dec 2006, tkubaska at charter.net wrote:

> CREATE TABLE `ACCT_account`
> (`id` int NOT NULL AUTO_INCREMENT ,
> `name` varchar(100) NOT NULL DEFAULT '' ,
> `parent` int DEFAULT '' ,
> PRIMARY KEY (`id`))
> TYPE=InnoDB;

   I know nothing about MySqueal, but in PostgreSQL and SQLite3 there is no
quoting around the names of variables. So the above would be written:

   create table ACCT_account (id interger not null auto_increment,
                              name varchar(100) not null default ' ',
 			     parent integer default NULL,
 			     primary key (id));

   Notice that your parent field is an integer but you're assigning an empty
string as the default. You should assign a number or NULL if the poor field
doesn't know who its parent is.

HTH,

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.(TM)    |            Accelerator
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863



More information about the PLUG mailing list