江湖救急,找不到错误在哪里,难道真的是当局者迷。
mysql> CREATE TABLE provinces(
-> id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
-> pname VARCHAR(10) NOT NULL
-> );
Query OK, 0 rows affected (0.01 sec)
mysql> CREATE TABLE users(
-> id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
-> username VARCHAR(10) NOT NULL,
-> pid SMALLINT UNSIGNED ,
-> FOREING KEY (pid) REFERENCES provinces (id)
-> );
ERROR 1064 (42000): 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 'KEY (pid) REFERENCES provinces (id)
)' at line 5