Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What data type decimal is used to set the decimal point in Mysql?
What data type decimal is used to set the decimal point in Mysql?
The decimal point in mysql is stored in decimal(x, y),

Examples are as follows:

1, create a test table and create a table test _ decimal (ID int, fee _ value decimal (20 20,3));

2. Insert test data,

Insert into the test_decimal value (1,12.2);

Insert into the test_decimal value (3,33.789);

Inserted into the test_decimal value (6666,555.332);

3. Query all records in the table, select * from test _ decimal t;;

4, decimal rounding, you can use floor or round function, select T. *, floor (fee _ value) is fee 1, round (fee _ value) fee2from test _ decimal t;