mysql decimal data type code example

Example 1: mysql text to decimal

SELECT CAST(colName AS DECIMAL(10,2))
FROM tableName

Example 2: mysql decimal

column_name DECIMAL(precision, scale)
-- DECIMAL stores exact numeric values with a fixed decimal point.
-- The precision is the total number of digits before AND after the decimal point.
-- The scale is the number of digits after the decimal point.

Example 3: mysql url data type

< MySQL 5.0.3 use TEXT
or
>= MySQL 5.0.3 use VARCHAR(2083)

Example 4: mysql type for large numbers with many decimal

CREATE TABLE tab(col DECIMAL(20,10));

Example 5: mysql decimal

column_name DECIMAL(5,2)

Tags:

Sql Example