1264 Out of range value adjusted for column with decimal field

0

I have a hotel table in my database with a estrelas(decimal(1,1)) column that receives the hotel's note (from 0.0 to 5.0), but whenever I try to enter or change a field and put a higher value that 0.9 it does not record giving this alert:

  Warning: # 1264 Out of range value adjusted for column 'stars' at row 1

and the value returns to 0.9.

Does anyone know what this can 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.

    
asked by anonymous 08.03.2016 / 21:15

1 answer

1

The problem is in the data type. Try switching to decimal(3,2) . According to the documentation, the first parameter is the maximum number of digits, while the second is the number of numbers on the right side of the decimal point.

    
08.03.2016 / 21:24