英文:
SQL #1064 error but i can't figure it out
问题
>1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') NULL , cashExp
VARCHAR(30) NOT NULL DEFAULT 'غير معروف' , `cashDa...' at line 1
this is an image of what i did
CREATE TABLE balancemapper
.homedata
(
cash
DOUBLE(100000) NULL ,
cashExp
VARCHAR(30) NOT NULL DEFAULT 'غير معروف' ,
cashDate
DATE NOT NULL DEFAULT CURRENT_TIMESTAMP ,
cashComms
VARCHAR(100) NOT NULL DEFAULT 'لا يوجد' ,
PRIMARY KEY (cash
)
) ENGINE = InnoDB;
i can't figure it out i searched online but can't
i tried changing the default value from null to anything else and to none and null but no difference
i tried changing the date to varchar but nothing changed
i changed the length also nothing changed
英文:
>1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') NULL , cashExp
VARCHAR(30) NOT NULL DEFAULT 'غير معروف' , `cashDa...' at line 1
this is an image of what i did
CREATE TABLE `balancemapper`.`homedata` (
`cash` DOUBLE(100000) NULL ,
`cashExp` VARCHAR(30) NOT NULL DEFAULT 'غير معروف' ,
`cashDate` DATE NOT NULL DEFAULT CURRENT_TIMESTAMP ,
`cashComms` VARCHAR(100) NOT NULL DEFAULT 'لا يوجد' ,
PRIMARY KEY (`cash`)
) ENGINE = InnoDB;
i can't figure it out i searched online but can't
i tried changing the default value from null to anything else and to none and null but no difference
i tried changing the date to varchar but nothing changed
i changed teh length also nothing changed
答案1
得分: 1
FLOAT
和 DOUBLE
只接受两个参数或不接受参数。不能只提供一个参数。
MariaDB 不支持 100000 位数的精度。我记得限制是 255。
CREATE TABLE `balancemapper`.`homedata` (
`cash` DOUBLE(100000,2) NULL
);
错误:cash
的显示宽度超出范围(最大为 255)。
此外,如果在 cash
列中存储货币值,不应该使用 FLOAT
或 DOUBLE
。应该使用 DECIMAL
作为固定精度的缩放数据类型。
另请参考 https://mariadb.com/kb/en/double/。
英文:
FLOAT
and DOUBLE
takes either two arguments or none. You can't give it a single argument.
MariaDB does not support a precision of 100000 digits. I recall the limit is 255.
CREATE TABLE `balancemapper`.`homedata` (
`cash` DOUBLE(100000,2) NULL
);
Error: Display width out of range for 'cash' (max = 255)
Also if you are storing currency values in the cash
column, you shouldn't use FLOAT
or DOUBLE
anyway. You should use DECIMAL
for a fixed-precision scaled data type.
See also https://mariadb.com/kb/en/double/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论