MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
1PLs Company - #1Payday.Loans Agency - Loans online and near me $100-$2500 (Same Day)
Powered by MySQL
 
Home / Database Structure / Data Types / Question No: 101

What are float data types in MySQL?


Answer No: 101

In MySQL 5 Certification Study Guide, Numeric data types are described as below:

The floating-point data types include FLOAT and   DOUBLE. Each of these types may be used to represent approximate-value   numbers that have an integer part, a fractional part, or both. FLOAT   and DOUBLE data types represent values in the native binary   floating-point format used by the server host's CPU. This is a very efficient   type for storage and computation, but values are subject to rounding error.

FLOAT represents single-precision floating-point   values that require four bytes each for storage. DOUBLE represents   double-precision floating-point values that require eight bytes each for   storage.

You can specify explicit precision and scale values in the   column definition to indicate the number of significant digits and the number of   decimal places to the right of the decimal point. The following definitions   specify a single-precision column with a precision of 10 digits and scale of 3   decimals, and a double-precision column with a precision of 20 digits and scale   of 7 decimals:

weight FLOAT(10,3)
avg_score DOUBLE(20,7)

If you specify no precision or scale, MySQL represents values   stored in FLOAT and DOUBLE columns to the maximum accuracy   allowed by the hardware of the MySQL server host. The following definitions   include no explicit precision or scale:

float_col FLOAT
double_col DOUBLE   

Floating-point values are stored using mantissa/exponent   representation, which means that the precision is defined by the width of the   mantissa and the scale varies depending on the exponent value. The result of   these factors is that stored values are approximate.

Related MySQL FAQs to the Above FAQ

What-is-BIT-Data-Type-in-MySQL What is BIT Data Type in MySQL?

What-are-numeric-data-types-in-MySQL What are numeric data types in MySQL?

What-are-integer-data-types-in-MySQL What are integer data types in MySQL?

What-is-fixed-point-and-decimal-data-type-in-MySQL What is fixed point and decimal data type in MySQL?

What-is-MySQL-default-character-set What is MySQL default character set?

What-is-difference-between-binary-and-non-binary-string-data-types What is difference between binary and non-binary string data types?

What-are-ENUM-and-SET-Data-Types-in-MySQL What are ENUM and SET Data Types in MySQL?

What-is-difference-between-CHAR-AND-VARCHAR-data-types What is difference between CHAR AND VARCHAR data types?

What-are-string-data-types-in-MySQL-5 What are string data types in MySQL 5?

How-to-reformat-date-values-in-MySQL How to reformat date values in MySQL?

How-to-reformat-Time-values-in-MySQL How to reformat Time values in MySQL?

What-are-Temporal-Data-Types-in-MySQL What are Temporal Data Types in MySQL?

What-are-DATE-TIME-DATETIME-and-YEAR-Data-Types-in-MySQL What are DATE, TIME, DATETIME and YEAR Data Types in MySQL?

What-is-TIMESTAMP-Data-Type-in-MySQL What is TIMESTAMP Data Type in MySQL?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: Wikipedia.org | Oracle.com | w3schools.com | www.php.net | Github.com

© 2023  www.mysqlfaqs.net
All rights reserved.