Author: paul
Date: 2006-01-19 00:47:45 +0100 (Thu, 19 Jan 2006)
New Revision: 911
Log:
r6373@frost: paul | 2006-01-18 17:46:19 -0600
General revisions.
Modified:
trunk/
trunk/refman-5.0/precision-math.xml
trunk/refman-5.1/precision-math.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:6372
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:2309
+ b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:6373
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:2309
Modified: trunk/refman-5.0/precision-math.xml
===================================================================
--- trunk/refman-5.0/precision-math.xml 2006-01-18 23:47:28 UTC (rev 910)
+++ trunk/refman-5.0/precision-math.xml 2006-01-18 23:47:45 UTC (rev 911)
@@ -79,9 +79,8 @@
<listitem>
<para>
- The introduction of new SQL modes in MySQL 5.0.2 that control
- how strict the server is about accepting or rejecting invalid
- data. (See <xref linkend="server-sql-mode"/>.)
+ The introduction of SQL modes in MySQL 5.0 that control how
+ strict the server is about accepting or rejecting invalid data.
</para>
</listitem>
@@ -141,7 +140,7 @@
rather than as an operation that produces a result of
<literal>NULL</literal>. The choice of which approach to take is
determined by the setting of the <literal>sql_mode</literal>
- system variable. (See <xref linkend="server-sql-mode"/>.)
+ system variable.
</para>
</listitem>
@@ -156,7 +155,10 @@
The following discussion covers several aspects of how precision
math works (including possible incompatibilities with older
applications). At the end, some examples are given that demonstrate
- how MySQL 5 handles numeric operations more precisely than before.
+ how MySQL ¤t-series; handles numeric operations precisely. For
+ information about using the <literal>sql_mode</literal> system
+ variable to control the SQL mode, see
+ <xref linkend="server-sql-mode"/>.
</para>
<section id="precision-math-numbers">
@@ -188,7 +190,7 @@
</para>
<para>
- Numbers that look similar need not be both exact-value or both
+ Two numbers that look similar need not be both exact-value or both
approximate-value. For example, <literal>2.34</literal> is an
exact-value (fixed-point) number, whereas
<literal>2.34E0</literal> is an approximate-value (floating-point)
@@ -218,8 +220,9 @@
<title>&title-precision-math-decimal-changes;</title>
<para>
- In MySQL 5.0.3, several changes were made to several aspects of
- the <literal>DECIMAL</literal> data type (and its synonyms):
+ This section discusses the characteristics of the
+ <literal>DECIMAL</literal> data type (and its synonyms) as of
+ MySQL 5.0.3, with particular regard to the following topics:
</para>
<itemizedlist>
@@ -332,7 +335,7 @@
<colspec colwidth="25*"/>
<tbody>
<row>
- <entry><emphasis role="bold">Digits Left Over</emphasis></entry>
+ <entry><emphasis role="bold">Leftover Digits</emphasis></entry>
<entry><emphasis role="bold">Number of Bytes</emphasis></entry>
</row>
<row>
@@ -547,24 +550,25 @@
<para>
Inserts into numeric columns are affected by the SQL mode, which
- is controlled by the sql_mode system variable. (See
- <xref linkend="sql-mode"/>.) The following discussion mentions
- strict mode (selected by the <literal>STRICT_ALL_TABLES</literal>
- or <literal>STRICT_TRANS_TABLES</literal> mode values) and
+ is controlled by the <literal>sql_mode</literal> system variable.
+ (See <xref linkend="sql-mode"/>.) The following discussion
+ mentions strict mode (selected by the
+ <literal>STRICT_ALL_TABLES</literal> or
+ <literal>STRICT_TRANS_TABLES</literal> mode values) and
<literal>ERROR_FOR_DIVISION_BY_ZERO</literal>. To turn on all
restrictions, you can simply use <literal>TRADITIONAL</literal>
- mode, which includes both strict mode and
+ mode, which includes both strict mode values and
<literal>ERROR_FOR_DIVISION_BY_ZERO</literal>:
</para>
<programlisting>
-mysql> <userinput>SET SQL_MODE='TRADITIONAL';</userinput>
+mysql> <userinput>SET sql_mode='TRADITIONAL';</userinput>
</programlisting>
<para>
If a number is inserted into an exact type column
- (<literal>DECIMAL</literal> or integer), it should be inserted
- with its exact value if it is within the column range.
+ (<literal>DECIMAL</literal> or integer), it is inserted with its
+ exact value if it is within the column range.
</para>
<para>
@@ -669,7 +673,7 @@
</row>
<row>
<entry>strict,<literal>ERROR_FOR_DIVISION_BY_ZERO</literal></entry>
- <entry>Error condition; no row inserted.</entry>
+ <entry>Error condition; no row is inserted.</entry>
</row>
</tbody>
</tgroup>
@@ -695,7 +699,8 @@
<listitem>
<para>
A string that begins with a number can be converted, but the
- trailing non-numeric portion is truncated. This produces an
+ trailing non-numeric portion is truncated. If the truncated
+ portion contains anything other than spaces, this produces an
error in strict mode, or a warning otherwise.
</para>
</listitem>
@@ -784,7 +789,7 @@
</programlisting>
<remark role="todo">
- Describe INT rounding when it gets fixes (insert involving quoted
+ Describe INT rounding when it gets fixed (insert involving quoted
numbers in scientific notation ignores everything following
decimal point.
</remark>
@@ -833,7 +838,7 @@
</programlisting>
<para>
- However, for floating-point values, results are inexact:
+ For floating-point values, results are inexact:
</para>
<programlisting>
@@ -1000,11 +1005,15 @@
</para>
<programlisting>
+<!--
+mysql> DROP TABLE IF EXISTS t;
+Query OK, 0 rows affected (0.00 sec)
+-->
mysql> <userinput>CREATE TABLE t (i TINYINT);</userinput>
-Query OK, 0 rows affected (0.00 sec)
+Query OK, 0 rows affected (0.01 sec)
mysql> <userinput>INSERT INTO t SET i = 128;</userinput>
-Query OK, 1 row affected, 1 warning (0.01 sec)
+Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> <userinput>SELECT i FROM t;</userinput>
+------+
@@ -1020,15 +1029,16 @@
</para>
<programlisting>
-mysql> <userinput>SET SQL_MODE='TRADITIONAL';</userinput>
+<!--
+mysql> DROP TABLE IF EXISTS t;
+Query OK, 0 rows affected (0.01 sec)
+-->
+mysql> <userinput>SET sql_mode='STRICT_ALL_TABLES';</userinput>
Query OK, 0 rows affected (0.00 sec)
mysql> <userinput>CREATE TABLE t (i TINYINT);</userinput>
-Query OK, 0 rows affected (0.01 sec)
+Query OK, 0 rows affected (0.00 sec)
-mysql> <userinput>SET sql_mode='STRICT_ALL_TABLES';</userinput>
-Query OK, 0 rows affected (0.10 sec)
-
mysql> <userinput>INSERT INTO t SET i = 128;</userinput>
ERROR 1264 (22003): Out of range value adjusted for column 'i' at row 1
@@ -1050,11 +1060,15 @@
</para>
<programlisting>
+<!--
+mysql> DROP TABLE IF EXISTS t;
+Query OK, 0 rows affected (0.00 sec)
+-->
mysql> <userinput>CREATE TABLE t (i TINYINT);</userinput>
Query OK, 0 rows affected (0.01 sec)
mysql> <userinput>INSERT INTO t SET i = 1 / 0;</userinput>
-Query OK, 1 row affected (0.06 sec)
+Query OK, 1 row affected (0.00 sec)
mysql> <userinput>SELECT i FROM t;</userinput>
+------+
@@ -1062,7 +1076,7 @@
+------+
| NULL |
+------+
-1 row in set (0.01 sec)
+1 row in set (0.00 sec)
</programlisting>
<para>
@@ -1071,15 +1085,16 @@
</para>
<programlisting>
-mysql> SET SQL_MODE='TRADITIONAL';
+<!--
+mysql> DROP TABLE IF EXISTS t;
Query OK, 0 rows affected (0.00 sec)
+-->
+mysql> <userinput>SET sql_mode='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO';</userinput>
+Query OK, 0 rows affected (0.00 sec)
mysql> <userinput>CREATE TABLE t (i TINYINT);</userinput>
Query OK, 0 rows affected (0.00 sec)
-mysql> <userinput>SET sql_mode='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO';</userinput>
-Query OK, 0 rows affected (0.00 sec)
-
mysql> <userinput>INSERT INTO t SET i = 1 / 0;</userinput>
ERROR 1365 (22012): Division by 0
@@ -1088,23 +1103,28 @@
</programlisting>
<para>
- <emphasis role="bold">Example 6</emphasis>. In MySQL 4 (before
- precision math was introduced), both exact-value and
+ <emphasis role="bold">Example 6</emphasis>. Prior to MySQL 5.0.3
+ (before precision math was introduced), both exact-value and
approximate-value literals were converted to double-precision
floating-point values:
</para>
<programlisting>
+<!--
+mysql> DROP TABLE IF EXISTS t;
+Query OK, 0 rows affected, 1 warning (0.03 sec)
+-->
mysql> <userinput>SELECT VERSION();</userinput>
-+-----------------+
-| VERSION() |
-+-----------------+
-| 4.0.25-standard |
-+-----------------+
-1 row in set (0.00 sec)
++------------+
+| VERSION() |
++------------+
+| 4.1.18-log |
++------------+
+1 row in set (0.01 sec)
-
mysql> <userinput>CREATE TABLE t SELECT 2.5 AS a, 25E-1 AS b;</userinput>
+Query OK, 1 row affected (0.07 sec)
+Records: 1 Duplicates: 0 Warnings: 0
mysql> <userinput>DESCRIBE t;</userinput>
+-------+-------------+------+-----+---------+-------+
@@ -1116,35 +1136,42 @@
</programlisting>
<para>
- In MySQL ¤t-series;, the approximate-value literal still is
+ As of MySQL 5.0.3, the approximate-value literal still is
converted to floating-point, but the exact-value literal is
handled as <literal>DECIMAL</literal>:
</para>
<programlisting>
+<!--
+mysql> DROP TABLE IF EXISTS t;
+Query OK, 0 rows affected, 1 warning (0.03 sec)
+-->
mysql> <userinput>SELECT VERSION();</userinput>
-+-----------------+
-| VERSION() |
-+-----------------+
-| 5.0.15-standard |
-+-----------------+
-1 row in set (0.00 sec)
++------------+
+| VERSION() |
++------------+
+| 5.0.19-log |
++------------+
+1 row in set (0.17 sec)
mysql> <userinput>CREATE TABLE t SELECT 2.5 AS a, 25E-1 AS b;</userinput>
+Query OK, 1 row affected (0.19 sec)
+Records: 1 Duplicates: 0 Warnings: 0
mysql> <userinput>DESCRIBE t;</userinput>
-+-------+--------------+------+-----+---------+-------+
-| Field | Type | Null | Key | Default | Extra |
-+-------+--------------+------+-----+---------+-------+
-| a | decimal(2,1) | NO | | 0.0 | |
-| b | double | NO | | 0 | |
-+-------+--------------+------+-----+---------+-------+
++-------+-----------------------+------+-----+---------+-------+
+| Field | Type | Null | Key | Default | Extra |
++-------+-----------------------+------+-----+---------+-------+
+| a | decimal(2,1) unsigned | NO | | 0.0 | |
+| b | double | NO | | 0 | |
++-------+-----------------------+------+-----+---------+-------+
+2 rows in set (0.02 sec)
</programlisting>
<para>
<emphasis role="bold">Example 7</emphasis>. If the argument to an
- aggregate function is an exact numeric type, the result is also,
- with a scale at least that of the argument.
+ aggregate function is an exact numeric type, the result is also an
+ exact numeric type, with a scale at least that of the argument.
</para>
<para>
@@ -1158,7 +1185,7 @@
</programlisting>
<para>
- Result in MySQL 4.0 or 4.1 (prior to the introduction of precision
+ Result before MySQL 5.0.3 (prior to the introduction of precision
math in MySQL):
</para>
@@ -1193,10 +1220,10 @@
</programlisting>
<para>
- The result is a double only for the floating-point argument.
- <emphasis>For exact type arguments, the result is also an exact
- type.</emphasis> (From MySQL 5.0.3 to 5.0.6, the first two columns
- are <literal>DECIMAL(64,0)</literal>.)
+ The result is a double only for the floating-point argument. For
+ exact type arguments, the result is also an exact type. (From
+ MySQL 5.0.3 to 5.0.6, the first two columns are
+ <literal>DECIMAL(64,0)</literal>.)
</para>
</section>
Modified: trunk/refman-5.1/precision-math.xml
===================================================================
--- trunk/refman-5.1/precision-math.xml 2006-01-18 23:47:28 UTC (rev 910)
+++ trunk/refman-5.1/precision-math.xml 2006-01-18 23:47:45 UTC (rev 911)
@@ -80,9 +80,7 @@
<listitem>
<para>
SQL modes that control how strict the server is about accepting
- or rejecting invalid data. (See
- <xref
- linkend="server-sql-mode"/>.)
+ or rejecting invalid data.
</para>
</listitem>
@@ -141,7 +139,7 @@
rather than as an operation that produces a result of
<literal>NULL</literal>. The choice of which approach to take is
determined by the setting of the <literal>sql_mode</literal>
- system variable. (See <xref linkend="server-sql-mode"/>.)
+ system variable.
</para>
</listitem>
@@ -156,7 +154,10 @@
The following discussion covers several aspects of how precision
math works (including possible incompatibilities with older
applications). At the end, some examples are given that demonstrate
- how MySQL ¤t-series; handles numeric operations precisely.
+ how MySQL ¤t-series; handles numeric operations precisely. For
+ information about using the <literal>sql_mode</literal> system
+ variable to control the SQL mode, see
+ <xref linkend="server-sql-mode"/>.
</para>
<section id="precision-math-numbers">
@@ -188,7 +189,7 @@
</para>
<para>
- Numbers that look similar need not be both exact-value or both
+ Two numbers that look similar need not be both exact-value or both
approximate-value. For example, <literal>2.34</literal> is an
exact-value (fixed-point) number, whereas
<literal>2.34E0</literal> is an approximate-value (floating-point)
@@ -220,7 +221,7 @@
<para>
This section discusses the characteristics of the
<literal>DECIMAL</literal> data type (and its synonyms) in MySQL
- ¤t-series;, particularly with regard to the following:
+ ¤t-series;, with particular regard to the following topics:
</para>
<itemizedlist>
@@ -321,7 +322,7 @@
<colspec colwidth="25*"/>
<tbody>
<row>
- <entry><emphasis role="bold">Digits Left Over</emphasis></entry>
+ <entry><emphasis role="bold">Leftover Digits</emphasis></entry>
<entry><emphasis role="bold">Number of Bytes</emphasis></entry>
</row>
<row>
@@ -369,13 +370,14 @@
</informaltable>
<para>
- Unlike some older versions of MySQL, <literal>DECIMAL</literal>
- columns in MySQL ¤t-series; do not store a leading
- <literal>+</literal> character or leading <literal>0</literal>
- digits. If you insert <literal>+0003.1</literal> into a
- <literal>DECIMAL(5,1)</literal> column, it is stored as
- <literal>3.1</literal>. Applications that rely on the older
- behavior must be modified to account for this change.
+ Unlike some older versions of MySQL (prior to 5.0.3),
+ <literal>DECIMAL</literal> columns in MySQL ¤t-series; do
+ not store a leading <literal>+</literal> character or leading
+ <literal>0</literal> digits. If you insert
+ <literal>+0003.1</literal> into a <literal>DECIMAL(5,1)</literal>
+ column, it is stored as <literal>3.1</literal>. Applications that
+ rely on the older behavior must be modified to account for this
+ change.
</para>
<para>
@@ -387,9 +389,9 @@
<literal>DECIMAL(<replaceable>M</replaceable>,<replaceable>D</replaceable>)</literal>
column allows at most <replaceable>M</replaceable> −
<replaceable>D</replaceable> digits to the left of the decimal
- point. (This is not compatible with applications relying on older
+ point. This is not compatible with applications relying on older
versions of MySQL that allowed storing an extra digit in lieu of a
- <literal>+</literal> sign.)
+ <literal>+</literal> sign.
</para>
<para>
@@ -408,9 +410,9 @@
</para>
<para>
- For more detailed information about porting applications that
- relied on the old treatment of the <literal>DECIMAL</literal> data
- type, see the <citetitle>&title-refman-5-0;</citetitle>.
+ For more detailed information about porting applications that rely
+ on the old treatment of the <literal>DECIMAL</literal> data type,
+ see the <citetitle>&title-refman-5-0;</citetitle>.
</para>
</section>
@@ -480,24 +482,25 @@
<para>
Inserts into numeric columns are affected by the SQL mode, which
- is controlled by the sql_mode system variable. (See
- <xref linkend="sql-mode"/>.) The following discussion mentions
- strict mode (selected by the <literal>STRICT_ALL_TABLES</literal>
- or <literal>STRICT_TRANS_TABLES</literal> mode values) and
+ is controlled by the <literal>sql_mode</literal> system variable.
+ (See <xref linkend="sql-mode"/>.) The following discussion
+ mentions strict mode (selected by the
+ <literal>STRICT_ALL_TABLES</literal> or
+ <literal>STRICT_TRANS_TABLES</literal> mode values) and
<literal>ERROR_FOR_DIVISION_BY_ZERO</literal>. To turn on all
restrictions, you can simply use <literal>TRADITIONAL</literal>
- mode, which includes both strict mode and
+ mode, which includes both strict mode values and
<literal>ERROR_FOR_DIVISION_BY_ZERO</literal>:
</para>
<programlisting>
-mysql> <userinput>SET SQL_MODE='TRADITIONAL';</userinput>
+mysql> <userinput>SET sql_mode='TRADITIONAL';</userinput>
</programlisting>
<para>
If a number is inserted into an exact type column
- (<literal>DECIMAL</literal> or integer), it should be inserted
- with its exact value if it is within the column range.
+ (<literal>DECIMAL</literal> or integer), it is inserted with its
+ exact value if it is within the column range.
</para>
<para>
@@ -602,7 +605,7 @@
</row>
<row>
<entry>strict,<literal>ERROR_FOR_DIVISION_BY_ZERO</literal></entry>
- <entry>Error condition; no row inserted.</entry>
+ <entry>Error condition; no row is inserted.</entry>
</row>
</tbody>
</tgroup>
@@ -628,7 +631,8 @@
<listitem>
<para>
A string that begins with a number can be converted, but the
- trailing non-numeric portion is truncated. This produces an
+ trailing non-numeric portion is truncated. If the truncated
+ portion contains anything other than spaces, this produces an
error in strict mode, or a warning otherwise.
</para>
</listitem>
@@ -748,7 +752,7 @@
</programlisting>
<para>
- However, for floating-point values, results are inexact:
+ For floating-point values, results are inexact:
</para>
<programlisting>
@@ -822,8 +826,8 @@
</para>
<para>
- In MySQL ¤t-series;, rounding behavior (for example, with
- the <literal>ROUND()</literal> function) is independent of the
+ Rounding behavior (for example, with the
+ <literal>ROUND()</literal> function) is independent of the
implementation of the underlying C library, which means that
results are consistent from platform to platform.
</para>
@@ -834,10 +838,10 @@
</remark>
<para>
- In MySQL ¤t-series;, rounding for <literal>DECIMAL</literal>
- columns and exact-valued numbers uses the <quote>round half
- up</quote> rule. Values with a fractional part of .5 or greater
- are rounded away from zero to the nearest integer, as shown here:
+ Rounding for <literal>DECIMAL</literal> columns and exact-valued
+ numbers uses the <quote>round half up</quote> rule. Values with a
+ fractional part of .5 or greater are rounded away from zero to the
+ nearest integer, as shown here:
</para>
<programlisting>
@@ -877,14 +881,18 @@
</para>
<programlisting>
-mysql> <userinput>SET SQL_MODE='';</userinput>
+<!--
+mysql> DROP TABLE IF EXISTS t;
Query OK, 0 rows affected (0.00 sec)
+-->
+mysql> <userinput>SET sql_mode='';</userinput>
+Query OK, 0 rows affected (0.00 sec)
mysql> <userinput>CREATE TABLE t (i TINYINT);</userinput>
-Query OK, 0 rows affected (0.00 sec)
+Query OK, 0 rows affected (0.01 sec)
mysql> <userinput>INSERT INTO t SET i = 128;</userinput>
-Query OK, 1 row affected, 1 warning (0.01 sec)
+Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> <userinput>SELECT i FROM t;</userinput>
+------+
@@ -900,15 +908,16 @@
</para>
<programlisting>
-mysql> <userinput>SET SQL_MODE='TRADITIONAL';</userinput>
+<!--
+mysql> DROP TABLE IF EXISTS t;
+Query OK, 0 rows affected (0.01 sec)
+-->
+mysql> <userinput>SET sql_mode='STRICT_ALL_TABLES';</userinput>
Query OK, 0 rows affected (0.00 sec)
mysql> <userinput>CREATE TABLE t (i TINYINT);</userinput>
-Query OK, 0 rows affected (0.01 sec)
+Query OK, 0 rows affected (0.00 sec)
-mysql> <userinput>SET sql_mode='STRICT_ALL_TABLES';</userinput>
-Query OK, 0 rows affected (0.10 sec)
-
mysql> <userinput>INSERT INTO t SET i = 128;</userinput>
ERROR 1264 (22003): Out of range value adjusted for column 'i' at row 1
@@ -929,14 +938,18 @@
</para>
<programlisting>
-mysql> <userinput>SET SQL_MODE='';</userinput>
+<!--
+mysql> DROP TABLE IF EXISTS t;
Query OK, 0 rows affected (0.00 sec)
+-->
+mysql> <userinput>SET sql_mode='';</userinput>
+Query OK, 0 rows affected (0.01 sec)
mysql> <userinput>CREATE TABLE t (i TINYINT);</userinput>
-Query OK, 0 rows affected (0.01 sec)
+Query OK, 0 rows affected (0.00 sec)
mysql> <userinput>INSERT INTO t SET i = 1 / 0;</userinput>
-Query OK, 1 row affected (0.06 sec)
+Query OK, 1 row affected (0.00 sec)
mysql> <userinput>SELECT i FROM t;</userinput>
+------+
@@ -944,7 +957,7 @@
+------+
| NULL |
+------+
-1 row in set (0.01 sec)
+1 row in set (0.03 sec)
</programlisting>
<para>
@@ -953,15 +966,16 @@
</para>
<programlisting>
-mysql> SET SQL_MODE='TRADITIONAL';
+<!--
+mysql> DROP TABLE IF EXISTS t;
Query OK, 0 rows affected (0.00 sec)
+-->
+mysql> <userinput>SET sql_mode='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO';</userinput>
+Query OK, 0 rows affected (0.00 sec)
mysql> <userinput>CREATE TABLE t (i TINYINT);</userinput>
Query OK, 0 rows affected (0.00 sec)
-mysql> <userinput>SET sql_mode='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO';</userinput>
-Query OK, 0 rows affected (0.00 sec)
-
mysql> <userinput>INSERT INTO t SET i = 1 / 0;</userinput>
ERROR 1365 (22012): Division by 0
@@ -970,23 +984,28 @@
</programlisting>
<para>
- <emphasis role="bold">Example 6</emphasis>. In MySQL 4 (before
- precision math was introduced), both exact-value and
+ <emphasis role="bold">Example 6</emphasis>. Prior to MySQL 5.0.3
+ (before precision math was introduced), both exact-value and
approximate-value literals were converted to double-precision
floating-point values:
</para>
<programlisting>
+<!--
+mysql> DROP TABLE IF EXISTS t;
+Query OK, 0 rows affected, 1 warning (0.03 sec)
+-->
mysql> <userinput>SELECT VERSION();</userinput>
-+-----------------+
-| VERSION() |
-+-----------------+
-| 4.0.25-standard |
-+-----------------+
-1 row in set (0.00 sec)
++------------+
+| VERSION() |
++------------+
+| 4.1.18-log |
++------------+
+1 row in set (0.01 sec)
-
mysql> <userinput>CREATE TABLE t SELECT 2.5 AS a, 25E-1 AS b;</userinput>
+Query OK, 1 row affected (0.07 sec)
+Records: 1 Duplicates: 0 Warnings: 0
mysql> <userinput>DESCRIBE t;</userinput>
+-------+-------------+------+-----+---------+-------+
@@ -995,38 +1014,46 @@
| a | double(3,1) | | | 0.0 | |
| b | double | | | 0 | |
+-------+-------------+------+-----+---------+-------+
+2 rows in set (0.04 sec)
</programlisting>
<para>
- In MySQL ¤t-series;, the approximate-value literal still is
+ As of MySQL 5.0.3, the approximate-value literal still is
converted to floating-point, but the exact-value literal is
handled as <literal>DECIMAL</literal>:
</para>
<programlisting>
+<!--
+mysql> DROP TABLE IF EXISTS t;
+Query OK, 0 rows affected (0.25 sec)
+-->
mysql> <userinput>SELECT VERSION();</userinput>
+-----------------+
| VERSION() |
+-----------------+
-| 5.1.2-alpha-log |
+| 5.1.6-alpha-log |
+-----------------+
-1 row in set (0.00 sec)
+1 row in set (0.11 sec)
mysql> <userinput>CREATE TABLE t SELECT 2.5 AS a, 25E-1 AS b;</userinput>
+Query OK, 1 row affected (0.01 sec)
+Records: 1 Duplicates: 0 Warnings: 0
mysql> <userinput>DESCRIBE t;</userinput>
-+-------+--------------+------+-----+---------+-------+
-| Field | Type | Null | Key | Default | Extra |
-+-------+--------------+------+-----+---------+-------+
-| a | decimal(2,1) | NO | | 0.0 | |
-| b | double | NO | | 0 | |
-+-------+--------------+------+-----+---------+-------+
++-------+-----------------------+------+-----+---------+-------+
+| Field | Type | Null | Key | Default | Extra |
++-------+-----------------------+------+-----+---------+-------+
+| a | decimal(2,1) unsigned | NO | | 0.0 | |
+| b | double | NO | | 0 | |
++-------+-----------------------+------+-----+---------+-------+
+2 rows in set (0.01 sec)
</programlisting>
<para>
<emphasis role="bold">Example 7</emphasis>. If the argument to an
- aggregate function is an exact numeric type, the result is also,
- with a scale at least that of the argument.
+ aggregate function is an exact numeric type, the result is also an
+ exact numeric type, with a scale at least that of the argument.
</para>
<para>
@@ -1040,7 +1067,7 @@
</programlisting>
<para>
- Result in MySQL 4.0 or 4.1 (prior to the introduction of precision
+ Result before MySQL 5.0.3 (prior to the introduction of precision
math in MySQL):
</para>
@@ -1060,7 +1087,7 @@
</para>
<para>
- Result in MySQL ¤t-series;:
+ Result as of MySQL 5.0.3:
</para>
<programlisting>
@@ -1075,9 +1102,8 @@
</programlisting>
<para>
- The result is a double only for the floating-point argument.
- <emphasis>For exact type arguments, the result is also an exact
- type.</emphasis>
+ The result is a double only for the floating-point argument. For
+ exact type arguments, the result is also an exact type.
</para>
</section>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r911 - in trunk: . refman-5.0 refman-5.1 | paul | 19 Jan |