NUMERIC, DEC Synonym for DECIMAL : Decimal « Data Type « SQL / MySQL






NUMERIC, DEC Synonym for DECIMAL

    
mysql>
mysql> CREATE TABLE dishes (
    ->     dish_id INT,
    ->     dish_name VARCHAR(255),
    ->     price NUMERIC(4,2),
    ->     is_spicy INT
    -> );
Query OK, 0 rows affected (0.00 sec)

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

mysql>
mysql>
mysql> CREATE TABLE dishes (
    ->     dish_id INT,
    ->     dish_name VARCHAR(255),
    ->     price DEC(4,2),
    ->     is_spicy INT
    -> );
Query OK, 0 rows affected (0.00 sec)

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

mysql>

   
    
    
    
  








Related examples in the same category

1.Decimal and Numeric Data Field Syntax When 123.4567 Is Inserted
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