-3
Hello I’m trying to create the following table:
CREATE TABLE produtos(
id integer primary key auto_increment unique ,
nome varchar(255) unique,
descricao varchar(255),
preco varchar(10,2) ,
validade date
);
And the following sql error is pointed out:
Error Code: 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 '2) , validade date )' at line 5
Why the
preco
is asvarchar(10, 2)
? Shouldn’t be a numerical type?– Woss
@Andersoncarloswoss and by the way, probably
DECIMAL
, because using FLOAT will cause another problem (not syntax). Dear Mark, changepreco varchar(10,2)
forpreco decimal(10,2)
... Of course you have to see what average prices the system will accept and adjust as needed.– Guilherme Nascimento