MySQL Forums
Forum List  »  Newbie

Re: PHP and MySQL
Posted by: Roland Bouman
Date: August 01, 2005 08:30AM

I forgot to mention, you can explicitly name you constraints, I know for sure that this:

CREATE TABLE DIRECTORY (
ID INT UNSIGNED,
NAME VARCHAR(150) NOT NULL,
DESCRIPTION VARCHAR(500),
AVAILABLE TINYINT (1) UNSIGNED DEFAULT 1 NOT NULL,
PORTAUTHORITY TINYINT (1) UNSIGNED DEFAULT 0 NOT NULL,
PARENTID INT UNSIGNED,
HEADERIMAGE VARCHAR(100),
TITLEIMAGE VARCHAR(100),
BTNIMAGE VARCHAR(100),
DWNBTNIMAGE VARCHAR(100),
LIFESIMAGE1 VARCHAR(100),
LIFESIMAGE2 VARCHAR(100),
HTMLTEMPLATE VARCHAR(100),
MISCFIELD1 VARCHAR(100),
MISCFIELD2 VARCHAR(100),
MISCFIELD3 VARCHAR(100),
ping bit(1),
main bit(1),
nautica bit(1),
teamwear bit(1),
golf bit(1),
CONSTRAINT pk_dir PRIMARY KEY(ID),
CONSTRAINT fk_dir FOREIGN KEY(PARENTID) REFERENCES DIRECTORY(ID)
) engine = innodb;

works, so, the difference is that the constraint declarations are moved to after the last column definition.

One other thing I'd like to mention: In these posts, I typed teamwear, whereas in your original post the column was named teamwaer (which i assume is a typo).


Good luck, let us know if it worked this time, and sorry for any inconvenience.

Options: ReplyQuote


Subject
Written By
Posted
July 31, 2005 08:50AM
July 31, 2005 09:59AM
July 31, 2005 12:21PM
July 31, 2005 01:41PM
August 01, 2005 07:16AM
August 01, 2005 08:20AM
Re: PHP and MySQL
August 01, 2005 08:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.