I am trying to create the tables necessary for a homework project and got the following error (with 000webhost):
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{
id INT(100) NOT NULL AUTO_INCREMENT,
userid INT(100) NOT NULL,
acctstatu' at line 2
Here is the actual MySQL code:
CREATE TABLE a9290616_hms.account
{
id INT(100) NOT NULL AUTO_INCREMENT,
userid INT(100) NOT NULL,
acctstatus TINYINT(1) NOT NULL,
primary key (id),
foreign key (userid) references users(userid)
} ENGINE = MYISAM
CREATE TABLE a9290616_hms.users
{
userid INT(100) NOT NULL AUTO_INCREMENT PRIMARY KEY,
fname VARCHAR(60) NOT NULL,
lname VARCHAR(60) NOT NULL,
acctid INT(100),
primary key (userid),
foreign key (acctid) references account(id)
} ENGINE = MYISAM
CREATE TABLE a9290616_hms.activities
{
topicid INT(100) NOT NULL AUTO_INCREMENT PRIMARY KEY,
startdate DATE NOT NULL,
userid INT(100) NOT NULL,
primary key (topicid),
foreign key (userid) references users(userid)
} ENGINE = MYISAM
CREATE TABLE a9290616_hms.network
{
groupid INT(100) NOT NULL AUTO_INCREMENT PRIMARY KEY,
startdate DATE NOT NULL,
userid INT(100) NOT NULL,
primary key (groupid),
foreign key (userid) references users(userid)
} ENGINE = MYISAM
CREATE TABLE a9290616_hms.profile
{
userstatus VARCHAR(100),
description VARCHAR(255),
userid INT(100),
foreign key (userid) references us开发者_开发问答ers(userid)
} ENGINE = MYISAM
CREATE TABLE a9290616_hms.submissions
{
subid INT(100) NOT NULL AUTO_INCREMENT PRIMARY KEY,
content VARCHAR(255) NOT NULL,
topicid INT(100) NOT NULL,
primary key (subid),
foreign key (topicid) references activities(topicid)
} ENGINE = MYISAM
CREATE TABLE a9290616_hms.comments
{
commid INT(100) NOT NULL AUTO_INCREMENT PRIMARY KEY,
content VARCHAR(255) NOT NULL,
startdate DATE NOT NULL,
subid INT NOT NULL,
primary key (commid),
foreign key (subid) references submissions(subid)
} ENGINE = MYISAM
If someone could point out what I'm doing wrong that would be great.
Thanks in advance.
You simply have to use parentheses instead of curly braces.
I don't think you can use braces {}
. Try replacing them with parentheses ()
精彩评论