0
I have a hotel table in my database with a column estrelas(decimal(1,1))
which receives the hotel grade (from 0.0 to 5.0), however whenever I try to insert or change a field and put a value greater than 0.9 it does not record giving this warning:
Warning: #1264 Out of range value adjusted for column 'stars' at Row 1
and the value returns to 0,9.
Does anyone know what that could be? I already deleted the table and recreated with this sql code
CREATE TABLE IF NOT EXISTS hotel_db.Hotel (
id INT AUTO_INCREMENT PRIMARY KEY,
nome VARCHAR(100) NOT NULL,
endereco VARCHAR(100) NOT NULL,
estrelas DECIMAL(1,1);
)
but the error persists.
Then @user42020 put the field as decimal(2,1) and worked.
– Bruno Romualdo
As for the first number being the number of digits, I already knew, so I had put decimal (1,1) because I was going to insert values like 0.5, 2.5, 3.5 understood?
– Bruno Romualdo
Oh yes, I get it. I’m glad you solved. :)
– silvalexandre