简体   繁体   中英

mysql error 1064, i can't find the mistake

#1064 - 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 ')
)' at line 7 

i have got that problem, but i cannot realize where is the mistake.
i've read mysql error documentation, and it says the error is about parse. but i still dont understand yet, thank for your help.
here is an sql query :

CREATE TABLE IF NOT EXISTS produk_detil (
 id_produk varchar( 10 ) NOT NULL ,
 short_desc text NOT NULL ,
 long_desc text NOT NULL ,
 min_beli int( 5 ) ,
 jml_qty int( 10 ) ,
 berat double( 7 )
);

CREATE TABLE IF NOT EXISTS harga(
 id_produk varchar(10) NOT NULL,
 tgl_aktif date NOT NULL,
 tgl_deaktif date,
 nominal_harga double(10)
);

CREATE TABLE IF NOT EXISTS testimonials(
 id_testimoni varchar(10),
 id_produk varchar(10),
 id_user varchar(10),
 isi_konten text,
 tgl_buat date,
 tgl_modifikasi date
);

CREATE TABLE IF NOT EXISTS order(
 id_order varchar(10) NOT NULL PRIMARY KEY,
 id_user varchar(10) NOT NULL,
 tgl_order date,
 total_bayar double(15),
 jml_item int(10)
);

 CREATE TABLE IF NOT EXISTS order_detil(
 id_order varchar(10) NOT NULL,
 id_produk varchar(10) NOT NULL,
 harga double(15) NOT NULL,
 qty int(10)
 );

You have to provide the amount of decimal places for double, eg double (7, 2 ) means your number has a total of 7 digits, whereof 2 are decimal places, just like 10233,95

btw I would strongly recommend to get attuned to use english column names.. there will be one day people who need to understand your DB scheme and do not speak your language

You need to provide decimal places for the double. For eg: berat double( 7 ,2) will work fine

Check out the syntax for declaring columns with double datatype.

you have to indicate the length of the whole number and the length of decimal part

nominal_harga double(10,10)

read more here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM