Skip to content

DOUBLE

CREATE TABLE Employee (
ID int,
Salary DOUBLE(8,2)
);
INSERT INTO Employee(ID, Salary)
VALUES (1, 3500.75), (2, 4500.50);
SELECT * FROM Employee;
+------+---------+
| ID | Salary |
+------+---------+
| 1 | 3500.75 |
| 2 | 4500.50 |
+------+---------+

In this example, a table named Employee is created with two columns: ID (an integer) and Salary (a DOUBLE). A DOUBLE in MySQL is a floating-point number that allows for decimal points. The notation DOUBLE(8,2) specifies that the Salary numbers have a total of 8 digits, of which 2 are after the decimal point. The INSERT INTO statement is used to add two rows of data into the Employee table. Running SELECT * FROM Employee then retrieves all records from the table.