mysqlでのfloat

floatは4バイト、Dobuleは8バイト

mysql> CREATE TABLE google.float_test (
    -> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    -> num FLOAT(10, 2)
    -> ) ENGINE = MYISAM;
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT INTO float_test (num) VALUES (1.0), (1.1),(1.11),(1.111);
Query OK, 4 rows affected (0.13 sec)
Records: 4  Duplicates: 0  Warnings: 0

データを確認

mysql> select * from float_test;
+----+------+
| id | num  |
+----+------+
|  1 | 1.00 |
|  2 | 1.10 |
|  3 | 1.11 |
|  4 | 1.11 |
+----+------+
4 rows in set (0.00 sec)
CREATE TABLE google.float_test (
	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
	num FLOAT(6, 2)
) ENGINE = MYISAM;

INSERT INTO float_test (num) VALUES (1.0), (10.1),(100.11),(1000.111);

mysql> select * from float_test;
+----+---------+
| id | num     |
+----+---------+
|  1 |    1.00 |
|  2 |   10.10 |
|  3 |  100.11 |
|  4 | 1000.11 |
+----+---------+
4 rows in set (0.00 sec)

どうやらfloat(n.y) のnは全体の桁数、yは小数点以下の桁数ですね。