You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/dbmgmt/forge.rst
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,6 +120,40 @@ After the fields have been defined, they can be added using
120
120
``$forge->addField($fields)`` followed by a call to the
121
121
``createTable()`` method.
122
122
123
+
Notes on Data Types
124
+
-------------------
125
+
126
+
Floating-Point Types
127
+
^^^^^^^^^^^^^^^^^^^^
128
+
129
+
Floating-Point types such as ``FLOAT`` and ``DOUBLE`` represent approximate values.
130
+
Therefore, they should not be used when exact values are needed.
131
+
132
+
::
133
+
134
+
mysql> CREATE TABLE t (f FLOAT, d DOUBLE);
135
+
mysql> INSERT INTO t VALUES(99.9, 99.9);
136
+
137
+
mysql> SELECT * FROM t WHERE f=99.9;
138
+
Empty set (0.00 sec)
139
+
140
+
mysql> SELECT * FROM t WHERE f > 99.89 AND f < 99.91;
141
+
+------+------+
142
+
| f | d |
143
+
+------+------+
144
+
| 99.9 | 99.9 |
145
+
+------+------+
146
+
1 row in set (0.01 sec)
147
+
148
+
When it is important to preserve exact precision, for example with monetary data,
149
+
``DECIMAL`` or ``NUMERIC`` should be used.
150
+
151
+
TEXT
152
+
^^^^
153
+
154
+
``TEXT`` should not be used on SQLSRV. It is deprecated.
155
+
See `ntext, text, and image (Transact-SQL) - SQL Server | Microsoft Learn <https://learn.microsoft.com/en-us/sql/t-sql/data-types/ntext-text-and-image-transact-sql?view=sql-server-ver16>`_.
0 commit comments