Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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/

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading