Float type column type : Float « Data Type « SQL / MySQL






Float type column type

    
mysql>
mysql> CREATE TABLE MEASUREMENTS
    ->       (NR INTEGER, MEASUREMENT_VALUE FLOAT(1))
    -> ;
Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO MEASUREMENTS VALUES
    ->    (1, 99.99),
    ->    (2, 99999.99),
    ->    (3, 99999999.99),
    ->    (4, 99999999999.99),
    ->    (5, 99999999999999.99),
    ->    (6, 0.999999),
    ->    (7, 0.9999999),
    ->    (8, 99999999.9999),
    ->    (9, (1.0/3))
    -> ;
Query OK, 9 rows affected (0.00 sec)
Records: 9  Duplicates: 0  Warnings: 0

mysql> SELECT * FROM MEASUREMENTS;
+------+-------------------+
| NR   | MEASUREMENT_VALUE |
+------+-------------------+
|    1 |             99.99 |
|    2 |            100000 |
|    3 |            1e+008 |
|    4 |            1e+011 |
|    5 |            1e+014 |
|    6 |          0.999999 |
|    7 |                 1 |
|    8 |            1e+008 |
|    9 |          0.333333 |
+------+-------------------+
9 rows in set (0.00 sec)

mysql>
mysql> drop table MEASUREMENTS;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
  








Related examples in the same category

1.FLOAT(m, d): Floating-point number, 8-place accuracy (4 byte);
2.FLOAT(10,3)
3.FLOAT(19,3) ZEROFILL
4.A table definition that uses the DECIMAL and FLOAT data types.