>>>>> "Geocrawler" == Geocrawler com <archiver@stripped>
Geocrawler> This message was sent from Geocrawler.com by "Richard"
Geocrawler> Be sure to reply to that address.
Geocrawler> I am getting errors trying to create the following table:
Geocrawler> CREATE TABLE Review (
Geocrawler> review_id tinyint(5) NOT NULL ZEROFILL AUTO_INCREMENT,
Geocrawler> user_id varchar(25) NOT NULL,
Geocrawler> PRIMARY KEY (review_id),
Geocrawler> FOREIGN KEY (user_id)
Geocrawler> The mysql manual shows that foreign keys can be used. I tried the
> statement without the FOREIGN KEY line and I still get an error on line 2. Is there
> another way to delineate the attributes?
As you may have noted, the line number 2 is:
review_id tinyint(5) NOT NULL ZEROFILL AUTO_INCREMENT
(you have a also a bug in the foreign key definition, but it's
important to fix this problem first).
CREATE TABLE Review (review_id tinyint(5) ZEROFILL NOT NULL
AUTO_INCREMENT,user_id varchar(25) NOT NULL,PRIMARY KEY (review_id),
FOREIGN KEY (user_id) references other_table);
Note that the a foreign key definition as above doesn't really do
anything in any SQL server (except store the definition for later
retrieval). In SQL you define table relationship when you do a join.