gpt4 book ai didi

mysql - 无法用mysql建表

转载 作者:太空宇宙 更新时间:2023-11-03 11:21:26 25 4
gpt4 key购买 nike

我正在尝试使用 SHELL 在 MYSQL 表中创建。

代码

CREATE TABLE IF NOT EXISTS books(¬
book_id INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT,¬
author_id INTEGER UNSIGNED,¬
title VARCHAR(100) NOT NULL,¬
year INTEGER UNSIGNED NOT NULL DEFAULT 1900,¬
language VARCHAR(2) NOT NULL DEFAULT 'es',¬
cover_url VARCHAR(500),¬
price DOUBLE(6,2) NOT NULL DEFAULT 10.0,¬
sellable TINYINT(1) DEFAULT,¬
description TEXT¬
);¬

它给我这个错误:

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 '¬
book_id INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT,¬
author_id INTEGER UN' at line 1

最佳答案

看倒数第二行,你忘了给sellable一个默认值。

CREATE TABLE IF NOT EXISTS books( 
book_id INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT,
author_id INTEGER UNSIGNED,
title VARCHAR(100) NOT NULL,
year INTEGER UNSIGNED NOT NULL DEFAULT 1900,
language VARCHAR(2) NOT NULL DEFAULT 'es',
cover_url VARCHAR(500),
price DOUBLE(6,2) NOT NULL DEFAULT '10.0',
sellable TINYINT(1) DEFAULT 1,
description TEXT NOT NULL);

关于mysql - 无法用mysql建表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59463803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com