Functions and Modifiers for Use with
GROUP BY
Clauses
968
• The fifth number is an IEEE 802 node number that provides spatial uniqueness. A random number
is substituted if the latter is not available (for example, because the host computer has no Ethernet
card, or we do not know how to find the hardware address of an interface on your operating
system). In this case, spatial uniqueness cannot be guaranteed. Nevertheless, a collision should
have very low probability.
Currently, the MAC address of an interface is taken into account only on FreeBSD and Linux. On
other operating systems, MySQL uses a randomly generated 48-bit number.
mysql>
SELECT UUID();
-> '6ccd780c-baba-1026-9564-0040f4311e29'
Warning
Although
UUID()
[967]
values are intended to be unique, they are not
necessarily unguessable or unpredictable. If unpredictability is required, UUID
values should be generated some other way.
Note
UUID()
[967]
does not work with statement-based replication.
•
VALUES(col_name)
[968]
In an
INSERT ... ON DUPLICATE KEY UPDATE
statement, you can use the
VALUES(col_name)
function in the
UPDATE
clause to refer to column values from the
INSERT
portion of the statement. In other words,
VALUES(col_name)
in the
UPDATE
clause refers to the
value of
col_name
that would be inserted, had no duplicate-key conflict occurred. This function is
especially useful in multiple-row inserts. The
VALUES()
[968]
function is meaningful only in the
ON DUPLICATE KEY UPDATE
clause of
INSERT
statements and returns
NULL
otherwise. See
Section 13.2.5.3, “
INSERT ... ON DUPLICATE KEY UPDATE
Syntax”
.
mysql>
INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)
->
ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);
12.15. Functions and Modifiers for Use with
GROUP BY
Clauses
12.15.1.
GROUP BY
(Aggregate) Functions
Table 12.19. Aggregate (
GROUP BY
) Functions
Name
Description
AVG()
[969]
Return the average value of the argument
BIT_AND()
[969]
Return bitwise and
BIT_OR()
[969]
Return bitwise or
BIT_XOR()
[969]
Return bitwise xor
COUNT(DISTINCT)
[970]
Return the count of a number of different values
COUNT()
[970]
Return a count of the number of rows returned
GROUP_CONCAT()
[970]
Return a concatenated string
MAX()
[971]
Return the maximum value
MIN()
[971]
Return the minimum value
STD()
[971]
Return the population standard deviation
STDDEV_POP()
[972]
Return the population standard deviation
STDDEV_SAMP()
[972]
Return the sample standard deviation
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...