Home  >  Article  >  Database  >  How to use MySQL floating point data type

How to use MySQL floating point data type

WBOY
WBOYforward
2023-05-28 10:30:281115browse

 MySQL floating point data type

Floating point declaration: float(M,D) double(M,D)

Decimal(M,D) M:Total Digits D: Number of decimal places

 mysql>Create table stu(
  num1 float(5,2),
  num2 double(6,1)
  )

MySQL supports scientific notation

mysql>insert  into  stu values(6E-2)

Floating point precision will be lost

Note: Not specified The number of digits, float defaults to 6 digits after the decimal point. Double defaults to 17 bits.

The above is the detailed content of How to use MySQL floating point data type. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete