SQL #1064 error but i can't figure it out

Advertisements

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

>Solution :

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/

Leave a Reply Cancel reply