Decimal and Numeric Data Field Syntax When 123.4567 Is Inserted : Decimal « Data Type « SQL / MySQL






Decimal and Numeric Data Field Syntax When 123.4567 Is Inserted

    
+------------+-------------+---------+----------------------------------------------+ 
| Syntax     |Code         | Display |Description                                   |
+------------+-------------+---------+----------------------------------------------+ 
|DECIMAL(w,d)|DECIMAL(5,2) |123.46   |Number has been rounded up                    |
+------------+-------------+---------+----------------------------------------------+ 
|NUMERIC(w,d)|NUMERIC(7,4) |123.4567 | Exact fit. (7 digits, 4 decimal places)      |
+------------+-------------+---------+----------------------------------------------+ 
|DECIMAL(w)  |DECIMAL(9)   |123      |No decimal specified: defaults to 0 decimal.  |
|            |             |         |(9 digits, 6 padded places to left of number) |
+------------+-------------+---------+----------------------------------------------+ 
|DECIMAL     |DECIMAL      |123      |Default: 10 digits, 0 decimal places.         |    
|            |             |         | (10 digits, 7 padded places to left of number)|
+------------+-------------+---------+----------------------------------------------+ 
           
         
    
    
    
  








Related examples in the same category

1.NUMERIC, DEC Synonym for DECIMAL
2.DECIMAL(p, s) Fixed-point number, saved as a character string;
3.DECIMAL(4,2) for price
4.Insert value to a decimal value column
5.DECIMAL(7,2)
6.DECIMAL(7,2) ZEROFILL NOT NULL
7.Update decimal value
8.Decimal default value