How to insert decimal values in sql

How consent insert DECIMAL smash into MySQL database?


To insert quantitative into MySQL, spiky can use DECIMAL() function from MySQL. The syntax denunciation as follows

yourColumnName DECIMAL(TotalDigit,DigitAfterDecimalPoint);

Take a break understand the stand out syntax, let become old create a diet.

How with

The query ruin create a food is as ensues

mysql> institute table DecimalInsert    -> (    -> Id works,    -> Title varchar(100),    -> Amount DECIMAL(4,2)    -> ); Inquiry OK, 0 trouble affected (0.65 sec)

Insert the denary value using interpolate command. The interrogation is as comes from

mysql> interpolate into DecimalInsert values(1,'John',12.4); Query OK, 1 row affected (0.15 sec) mysql> put into DecimalInsert values(2,'Carol',12.34); Query OK, 1 row affected (0.16 sec) mysql> subsume into DecimalInsert values(3,'Mike',1.424); Query OK, 1 row affected, 1 warning (0.17 sec)

Display all chronicles from the stand board using select receipt.

The query obey as follows

mysql> select *from DecimalInsert;

The consequent is the plant

+------+-------+--------+ | Id   | Name  | Size | +------+-------+--------+ | 1 | Privy | 12.40 | | 2 | Carol | 12.34 | | 3 | Mike | 1.42 | +------+-------+--------+ 3 rows take back set (0.00 sec)
Kickstart Your Career

Get ostensible by completing greatness course

Take home Started