简体   繁体   中英

what is wrong in my mysql 5.7 syntax?

CREATE TABLE tt_inv_refresh (
id int PRIMARY KEY AUTO_INCREMENT,
cust_id int,
res_type enum,
refresh_dtls JSON,
FOREIGN KEY (cust_id));

Giving 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 ' refresh_dtls JSON, FOREIGN KEY (cust_id))' at line 4

another table is created with cust_id as primary key

You have to name the foreign key constraint

FOREIGN KEY (parent_id) <- constraint named as parent_id
    REFERENCES parent(id) <- references primary key in other table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM