List:Commits« Previous MessageNext Message »
From:paul.dubois Date:May 3 2011 10:43pm
Subject:svn commit - mysqldoc@oter02: r26118 - in trunk: . refman-5.0 refman-5.1 refman-5.5 refman-5.6 refman-6.0
View as plain text  
Author: pd221994
Date: 2011-05-04 00:43:50 +0200 (Wed, 04 May 2011)
New Revision: 26118

Log:
 r47691@dhcp-adc-twvpn-1-vpnpool-10-154-23-122:  paul | 2011-05-03 13:52:58 -0500
 Update GROUP BY/ONLY_FULL_GROUP_BY description


Modified:
   svk:merge
   trunk/refman-5.0/functions-core.xml
   trunk/refman-5.1/functions-core.xml
   trunk/refman-5.5/functions-core.xml
   trunk/refman-5.6/functions-core.xml
   trunk/refman-6.0/functions-core.xml

Property changes on: trunk
___________________________________________________________________

Modified: svk:merge
===================================================================


Changed blocks: 0, Lines Added: 0, Lines Deleted: 0; 1277 bytes


Modified: trunk/refman-5.0/functions-core.xml
===================================================================
--- trunk/refman-5.0/functions-core.xml	2011-05-03 18:31:01 UTC (rev 26117)
+++ trunk/refman-5.0/functions-core.xml	2011-05-03 22:43:50 UTC (rev 26118)
Changed blocks: 2, Lines Added: 40, Lines Deleted: 20; 4015 bytes

@@ -18496,37 +18496,54 @@
       </indexterm>
 
       <para>
-        MySQL extends the use of <literal>GROUP BY</literal> so that you
-        can use nonaggregated columns or calculations in the select list
-        that do not appear in the <literal>GROUP BY</literal> clause.
-        You can use this feature to get better performance by avoiding
-        unnecessary column sorting and grouping. For example, you need
-        not group on <literal>customer.name</literal> in the following
-        query:
+        In standard SQL, a query that includes a <literal>GROUP
+        BY</literal> clause cannot refer to nonaggregated columns in the
+        select list that are not named in the <literal>GROUP
+        BY</literal> clause. For example, this query is illegal in
+        standard SQL because the select list refers to the
+        <literal>name</literal> column, which is not named in the
+        <literal>GROUP BY</literal>:
       </para>
 
 <programlisting>
-SELECT order.custid, customer.name, MAX(payments)
-  FROM order,customer
-  WHERE order.custid = customer.custid
-  GROUP BY order.custid;
+SELECT o.custid, c.name, MAX(o.payment)
+  FROM orders AS o, customers AS c
+  WHERE o.custid = c.custid
+  GROUP BY o.custid;
 </programlisting>
 
       <para>
-        In standard SQL, you would have to add
-        <literal>customer.name</literal> to the <literal>GROUP
-        BY</literal> clause. In MySQL, the name is redundant.
+        For the query to be legal, the query would have to omit the
+        <literal>name</literal> column from the select list or name it
+        in the <literal>GROUP BY</literal> clause.
       </para>
 
       <para>
-        When using this feature, all rows in each group should have the
-        same values for the columns that are ommitted from the
-        <literal>GROUP BY</literal> part. The server is free to return
-        any value from the group, so the results are indeterminate
-        unless all values are the same.
+        By default, MySQL extends the use of <literal>GROUP BY</literal>
+        so that the select list can refer to nonaggregated columns not
+        named in the <literal>GROUP BY</literal> clause. This means that
+        the preceding query is legal in MySQL. You can use this feature
+        to get better performance by avoiding unnecessary column sorting
+        and grouping.
       </para>
 
       <para>
+        However, this feature is useful primarily when all values in
+        each nonaggregated column not named in the <literal>GROUP
+        BY</literal> are the same for each group. The server is free to
+        return any value from each group, so unless they are the same,
+        the values chosen are indeterminate.
+      </para>
+
+      <para>
+        The selection of values from each group cannot be influencedby
+        adding an <literal>ORDER BY</literal> clause. Sorting of the
+        result set occurs after values have been chosen, and
+        <literal>ORDER BY</literal> does not affect which values the
+        server chooses.
+      </para>
+
+      <para>
         A similar MySQL extension applies to the
         <literal>HAVING</literal> clause. Standard SQL does not permit
         the <literal>HAVING</literal> clause to name any column not

@@ -18543,7 +18560,10 @@
         BY</literal> does not apply. That is, columns not named in the
         <literal>GROUP BY</literal> clause cannot be used in the select
         list or <literal>HAVING</literal> clause if not enclosed in an
-        aggregate function.
+        aggregate function. However, as mentioned previously,
+        <literal>ORDER BY</literal> does not affect which values are
+        chosen from nonaggregated columns; it only sorts them after they
+        have been chosen.
       </para>
 
       <para>


Modified: trunk/refman-5.1/functions-core.xml
===================================================================
--- trunk/refman-5.1/functions-core.xml	2011-05-03 18:31:01 UTC (rev 26117)
+++ trunk/refman-5.1/functions-core.xml	2011-05-03 22:43:50 UTC (rev 26118)
Changed blocks: 2, Lines Added: 40, Lines Deleted: 20; 4015 bytes

@@ -20026,37 +20026,54 @@
       </indexterm>
 
       <para>
-        MySQL extends the use of <literal>GROUP BY</literal> so that you
-        can use nonaggregated columns or calculations in the select list
-        that do not appear in the <literal>GROUP BY</literal> clause.
-        You can use this feature to get better performance by avoiding
-        unnecessary column sorting and grouping. For example, you need
-        not group on <literal>customer.name</literal> in the following
-        query:
+        In standard SQL, a query that includes a <literal>GROUP
+        BY</literal> clause cannot refer to nonaggregated columns in the
+        select list that are not named in the <literal>GROUP
+        BY</literal> clause. For example, this query is illegal in
+        standard SQL because the select list refers to the
+        <literal>name</literal> column, which is not named in the
+        <literal>GROUP BY</literal>:
       </para>
 
 <programlisting>
-SELECT order.custid, customer.name, MAX(payments)
-  FROM order,customer
-  WHERE order.custid = customer.custid
-  GROUP BY order.custid;
+SELECT o.custid, c.name, MAX(o.payment)
+  FROM orders AS o, customers AS c
+  WHERE o.custid = c.custid
+  GROUP BY o.custid;
 </programlisting>
 
       <para>
-        In standard SQL, you would have to add
-        <literal>customer.name</literal> to the <literal>GROUP
-        BY</literal> clause. In MySQL, the name is redundant.
+        For the query to be legal, the query would have to omit the
+        <literal>name</literal> column from the select list or name it
+        in the <literal>GROUP BY</literal> clause.
       </para>
 
       <para>
-        When using this feature, all rows in each group should have the
-        same values for the columns that are ommitted from the
-        <literal>GROUP BY</literal> part. The server is free to return
-        any value from the group, so the results are indeterminate
-        unless all values are the same.
+        By default, MySQL extends the use of <literal>GROUP BY</literal>
+        so that the select list can refer to nonaggregated columns not
+        named in the <literal>GROUP BY</literal> clause. This means that
+        the preceding query is legal in MySQL. You can use this feature
+        to get better performance by avoiding unnecessary column sorting
+        and grouping.
       </para>
 
       <para>
+        However, this feature is useful primarily when all values in
+        each nonaggregated column not named in the <literal>GROUP
+        BY</literal> are the same for each group. The server is free to
+        return any value from each group, so unless they are the same,
+        the values chosen are indeterminate.
+      </para>
+
+      <para>
+        The selection of values from each group cannot be influencedby
+        adding an <literal>ORDER BY</literal> clause. Sorting of the
+        result set occurs after values have been chosen, and
+        <literal>ORDER BY</literal> does not affect which values the
+        server chooses.
+      </para>
+
+      <para>
         A similar MySQL extension applies to the
         <literal>HAVING</literal> clause. Standard SQL does not permit
         the <literal>HAVING</literal> clause to name any column not

@@ -20073,7 +20090,10 @@
         BY</literal> does not apply. That is, columns not named in the
         <literal>GROUP BY</literal> clause cannot be used in the select
         list or <literal>HAVING</literal> clause if not enclosed in an
-        aggregate function.
+        aggregate function. However, as mentioned previously,
+        <literal>ORDER BY</literal> does not affect which values are
+        chosen from nonaggregated columns; it only sorts them after they
+        have been chosen.
       </para>
 
       <para>


Modified: trunk/refman-5.5/functions-core.xml
===================================================================
--- trunk/refman-5.5/functions-core.xml	2011-05-03 18:31:01 UTC (rev 26117)
+++ trunk/refman-5.5/functions-core.xml	2011-05-03 22:43:50 UTC (rev 26118)
Changed blocks: 2, Lines Added: 40, Lines Deleted: 20; 4015 bytes

@@ -20337,37 +20337,54 @@
       </indexterm>
 
       <para>
-        MySQL extends the use of <literal>GROUP BY</literal> so that you
-        can use nonaggregated columns or calculations in the select list
-        that do not appear in the <literal>GROUP BY</literal> clause.
-        You can use this feature to get better performance by avoiding
-        unnecessary column sorting and grouping. For example, you need
-        not group on <literal>customer.name</literal> in the following
-        query:
+        In standard SQL, a query that includes a <literal>GROUP
+        BY</literal> clause cannot refer to nonaggregated columns in the
+        select list that are not named in the <literal>GROUP
+        BY</literal> clause. For example, this query is illegal in
+        standard SQL because the select list refers to the
+        <literal>name</literal> column, which is not named in the
+        <literal>GROUP BY</literal>:
       </para>
 
 <programlisting>
-SELECT order.custid, customer.name, MAX(payments)
-  FROM order,customer
-  WHERE order.custid = customer.custid
-  GROUP BY order.custid;
+SELECT o.custid, c.name, MAX(o.payment)
+  FROM orders AS o, customers AS c
+  WHERE o.custid = c.custid
+  GROUP BY o.custid;
 </programlisting>
 
       <para>
-        In standard SQL, you would have to add
-        <literal>customer.name</literal> to the <literal>GROUP
-        BY</literal> clause. In MySQL, the name is redundant.
+        For the query to be legal, the query would have to omit the
+        <literal>name</literal> column from the select list or name it
+        in the <literal>GROUP BY</literal> clause.
       </para>
 
       <para>
-        When using this feature, all rows in each group should have the
-        same values for the columns that are ommitted from the
-        <literal>GROUP BY</literal> part. The server is free to return
-        any value from the group, so the results are indeterminate
-        unless all values are the same.
+        By default, MySQL extends the use of <literal>GROUP BY</literal>
+        so that the select list can refer to nonaggregated columns not
+        named in the <literal>GROUP BY</literal> clause. This means that
+        the preceding query is legal in MySQL. You can use this feature
+        to get better performance by avoiding unnecessary column sorting
+        and grouping.
       </para>
 
       <para>
+        However, this feature is useful primarily when all values in
+        each nonaggregated column not named in the <literal>GROUP
+        BY</literal> are the same for each group. The server is free to
+        return any value from each group, so unless they are the same,
+        the values chosen are indeterminate.
+      </para>
+
+      <para>
+        The selection of values from each group cannot be influencedby
+        adding an <literal>ORDER BY</literal> clause. Sorting of the
+        result set occurs after values have been chosen, and
+        <literal>ORDER BY</literal> does not affect which values the
+        server chooses.
+      </para>
+
+      <para>
         A similar MySQL extension applies to the
         <literal>HAVING</literal> clause. Standard SQL does not permit
         the <literal>HAVING</literal> clause to name any column not

@@ -20384,7 +20401,10 @@
         BY</literal> does not apply. That is, columns not named in the
         <literal>GROUP BY</literal> clause cannot be used in the select
         list or <literal>HAVING</literal> clause if not enclosed in an
-        aggregate function.
+        aggregate function. However, as mentioned previously,
+        <literal>ORDER BY</literal> does not affect which values are
+        chosen from nonaggregated columns; it only sorts them after they
+        have been chosen.
       </para>
 
       <para>


Modified: trunk/refman-5.6/functions-core.xml
===================================================================
--- trunk/refman-5.6/functions-core.xml	2011-05-03 18:31:01 UTC (rev 26117)
+++ trunk/refman-5.6/functions-core.xml	2011-05-03 22:43:50 UTC (rev 26118)
Changed blocks: 2, Lines Added: 40, Lines Deleted: 20; 4015 bytes

@@ -20686,37 +20686,54 @@
       </indexterm>
 
       <para>
-        MySQL extends the use of <literal>GROUP BY</literal> so that you
-        can use nonaggregated columns or calculations in the select list
-        that do not appear in the <literal>GROUP BY</literal> clause.
-        You can use this feature to get better performance by avoiding
-        unnecessary column sorting and grouping. For example, you need
-        not group on <literal>customer.name</literal> in the following
-        query:
+        In standard SQL, a query that includes a <literal>GROUP
+        BY</literal> clause cannot refer to nonaggregated columns in the
+        select list that are not named in the <literal>GROUP
+        BY</literal> clause. For example, this query is illegal in
+        standard SQL because the select list refers to the
+        <literal>name</literal> column, which is not named in the
+        <literal>GROUP BY</literal>:
       </para>
 
 <programlisting>
-SELECT order.custid, customer.name, MAX(payments)
-  FROM order,customer
-  WHERE order.custid = customer.custid
-  GROUP BY order.custid;
+SELECT o.custid, c.name, MAX(o.payment)
+  FROM orders AS o, customers AS c
+  WHERE o.custid = c.custid
+  GROUP BY o.custid;
 </programlisting>
 
       <para>
-        In standard SQL, you would have to add
-        <literal>customer.name</literal> to the <literal>GROUP
-        BY</literal> clause. In MySQL, the name is redundant.
+        For the query to be legal, the query would have to omit the
+        <literal>name</literal> column from the select list or name it
+        in the <literal>GROUP BY</literal> clause.
       </para>
 
       <para>
-        When using this feature, all rows in each group should have the
-        same values for the columns that are ommitted from the
-        <literal>GROUP BY</literal> part. The server is free to return
-        any value from the group, so the results are indeterminate
-        unless all values are the same.
+        By default, MySQL extends the use of <literal>GROUP BY</literal>
+        so that the select list can refer to nonaggregated columns not
+        named in the <literal>GROUP BY</literal> clause. This means that
+        the preceding query is legal in MySQL. You can use this feature
+        to get better performance by avoiding unnecessary column sorting
+        and grouping.
       </para>
 
       <para>
+        However, this feature is useful primarily when all values in
+        each nonaggregated column not named in the <literal>GROUP
+        BY</literal> are the same for each group. The server is free to
+        return any value from each group, so unless they are the same,
+        the values chosen are indeterminate.
+      </para>
+
+      <para>
+        The selection of values from each group cannot be influencedby
+        adding an <literal>ORDER BY</literal> clause. Sorting of the
+        result set occurs after values have been chosen, and
+        <literal>ORDER BY</literal> does not affect which values the
+        server chooses.
+      </para>
+
+      <para>
         A similar MySQL extension applies to the
         <literal>HAVING</literal> clause. Standard SQL does not permit
         the <literal>HAVING</literal> clause to name any column not

@@ -20733,7 +20750,10 @@
         BY</literal> does not apply. That is, columns not named in the
         <literal>GROUP BY</literal> clause cannot be used in the select
         list or <literal>HAVING</literal> clause if not enclosed in an
-        aggregate function.
+        aggregate function. However, as mentioned previously,
+        <literal>ORDER BY</literal> does not affect which values are
+        chosen from nonaggregated columns; it only sorts them after they
+        have been chosen.
       </para>
 
       <para>


Modified: trunk/refman-6.0/functions-core.xml
===================================================================
--- trunk/refman-6.0/functions-core.xml	2011-05-03 18:31:01 UTC (rev 26117)
+++ trunk/refman-6.0/functions-core.xml	2011-05-03 22:43:50 UTC (rev 26118)
Changed blocks: 2, Lines Added: 40, Lines Deleted: 20; 4015 bytes

@@ -20628,37 +20628,54 @@
       </indexterm>
 
       <para>
-        MySQL extends the use of <literal>GROUP BY</literal> so that you
-        can use nonaggregated columns or calculations in the select list
-        that do not appear in the <literal>GROUP BY</literal> clause.
-        You can use this feature to get better performance by avoiding
-        unnecessary column sorting and grouping. For example, you need
-        not group on <literal>customer.name</literal> in the following
-        query:
+        In standard SQL, a query that includes a <literal>GROUP
+        BY</literal> clause cannot refer to nonaggregated columns in the
+        select list that are not named in the <literal>GROUP
+        BY</literal> clause. For example, this query is illegal in
+        standard SQL because the select list refers to the
+        <literal>name</literal> column, which is not named in the
+        <literal>GROUP BY</literal>:
       </para>
 
 <programlisting>
-SELECT order.custid, customer.name, MAX(payments)
-  FROM order,customer
-  WHERE order.custid = customer.custid
-  GROUP BY order.custid;
+SELECT o.custid, c.name, MAX(o.payment)
+  FROM orders AS o, customers AS c
+  WHERE o.custid = c.custid
+  GROUP BY o.custid;
 </programlisting>
 
       <para>
-        In standard SQL, you would have to add
-        <literal>customer.name</literal> to the <literal>GROUP
-        BY</literal> clause. In MySQL, the name is redundant.
+        For the query to be legal, the query would have to omit the
+        <literal>name</literal> column from the select list or name it
+        in the <literal>GROUP BY</literal> clause.
       </para>
 
       <para>
-        When using this feature, all rows in each group should have the
-        same values for the columns that are ommitted from the
-        <literal>GROUP BY</literal> part. The server is free to return
-        any value from the group, so the results are indeterminate
-        unless all values are the same.
+        By default, MySQL extends the use of <literal>GROUP BY</literal>
+        so that the select list can refer to nonaggregated columns not
+        named in the <literal>GROUP BY</literal> clause. This means that
+        the preceding query is legal in MySQL. You can use this feature
+        to get better performance by avoiding unnecessary column sorting
+        and grouping.
       </para>
 
       <para>
+        However, this feature is useful primarily when all values in
+        each nonaggregated column not named in the <literal>GROUP
+        BY</literal> are the same for each group. The server is free to
+        return any value from each group, so unless they are the same,
+        the values chosen are indeterminate.
+      </para>
+
+      <para>
+        The selection of values from each group cannot be influencedby
+        adding an <literal>ORDER BY</literal> clause. Sorting of the
+        result set occurs after values have been chosen, and
+        <literal>ORDER BY</literal> does not affect which values the
+        server chooses.
+      </para>
+
+      <para>
         A similar MySQL extension applies to the
         <literal>HAVING</literal> clause. Standard SQL does not permit
         the <literal>HAVING</literal> clause to name any column not

@@ -20675,7 +20692,10 @@
         BY</literal> does not apply. That is, columns not named in the
         <literal>GROUP BY</literal> clause cannot be used in the select
         list or <literal>HAVING</literal> clause if not enclosed in an
-        aggregate function.
+        aggregate function. However, as mentioned previously,
+        <literal>ORDER BY</literal> does not affect which values are
+        chosen from nonaggregated columns; it only sorts them after they
+        have been chosen.
       </para>
 
       <para>


Thread
svn commit - mysqldoc@oter02: r26118 - in trunk: . refman-5.0 refman-5.1 refman-5.5 refman-5.6 refman-6.0paul.dubois4 May