mysql 语法错误
2021-02-10 本文已影响0人
toExploreFuture
多个逗号都要报错,能不能智能点
CREATE TABLE tree (
tree_id INT AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(30),
`img_url` VARCHAR(100),
`user_id` INT,
CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES user(`user_id`), --这里不能带,
);
CREATE TABLE `node` (
`node_id` INT PRIMARY KEY auto_increment,
`name` VARCHAR(32),
`img_url` VARCHAR(100),
`parent_id` INT,
`tree_id` INT,
CONSTRAINT `fk_tree_id` FOREIGN KEY (tree_id) REFERENCES tree(tree_id) -- foreign key 后面要跟小括号
);