List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 24 1999 2:15pm
Subject:Re: is this valid?
View as plain text  
At 10:56 PM -0500 7/23/99, Geocrawler.com wrote:
>This message was sent from Geocrawler.com by "apoorva" <apm@stripped>
>Be sure to reply to that address.
>
>Is this Table structure valid speacially the referencing part?
>
>CREATE TABLE persons (
>                  id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
>                  name CHAR(60) NOT NULL,
>                  PRIMARY KEY (id)
>              );
>
>              CREATE TABLE shirts (
>                  id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
>                  style ENUM(`t-shirt`, `polo`, `dress`) NOT NULL,
>                  color ENUM(`red`, `blue`, `orange`, `white`, `black`)
>NOT NULL,
>                  owner SMALLINT UNSIGNED NOT NULL REFERENCES persons,
>                  PRIMARY KEY (id)
>              );
>
>ALthough it wont check for a key will, but if there is a key will it
>atleast show up on the shirts table?

No, the REFERENCES clause will be discarded.  You can check this for
yourself by entering the statement in mysql to create the table.
Then execute:

	% mysqldump -d your_db_name shirts

to see what kind of CREATE TABLE statement MySQL will generate for
your table.  The REFERENCES clause won't be there.

If you try this, you'll also discover that your CREATE TABLE statement
is illegal, because the ENUM column declarations use backquotes. :-)

You should use single quotes (forward single quotes) or double quotes
instead.

--
Paul DuBois, paul@stripped
Thread
is this valid?Geocrawler.com24 Jul
  • Re: is this valid?tonu24 Jul
  • Re: is this valid?Paul DuBois24 Jul