Hacked By AnonymousFox

Current Path : C:/AppServ/MySQL/data/mysql/
Upload File :
Current File : C:/AppServ/MySQL/data/mysql/help_topic.MYD

	(#JOINMySQL supports the following JOIN syntaxes for the table_references
part of SELECT statements and multiple-table DELETE and UPDATE
statements:

table_references:
    table_reference [, table_reference] ...

table_reference:
    table_factor
  | join_table

table_factor:
    tbl_name [[AS] alias]
        [{USE|IGNORE|FORCE} INDEX (key_list)]
  | ( table_references )
  | { OJ table_reference LEFT OUTER JOIN table_reference
        ON conditional_expr }

join_table:
    table_reference [INNER | CROSS] JOIN table_factor [join_condition]
  | table_reference STRAIGHT_JOIN table_factor
  | table_reference STRAIGHT_JOIN table_factor ON condition
  | table_reference LEFT [OUTER] JOIN table_reference join_condition
  | table_reference NATURAL [LEFT [OUTER]] JOIN table_factor
  | table_reference RIGHT [OUTER] JOIN table_reference join_condition
  | table_reference NATURAL [RIGHT [OUTER]] JOIN table_factor

join_condition:
    ON conditional_expr
  | USING (column_list)

A table reference is also known as a join expression.

The syntax of table_factor is extended in comparison with the SQL
Standard. The latter accepts only table_reference, not a list of them
inside a pair of parentheses.

This is a conservative extension if we consider each comma in a list of
table_reference items as equivalent to an inner join. For example:

SELECT * FROM t1 LEFT JOIN (t2, t3, t4)
                 ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)

is equivalent to:

SELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)
                 ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)

In MySQL, CROSS JOIN is a syntactic equivalent to INNER JOIN (they can
replace each other). In standard SQL, they are not equivalent. INNER
JOIN is used with an ON clause, CROSS JOIN is used otherwise.

In versions of MySQL prior to 5.0.1, parentheses in table_references
were just omitted and all join operations were grouped to the left. In
general, parentheses can be ignored in join expressions containing only
inner join operations. As of 5.0.1, nested joins are allowed (see
[nested-joins]).

Further changes in join processing were made in 5.0.12 to make MySQL
more compliant with standard SQL. These charges are described later in
this section.
aSELECT table1.* FROM table1
  LEFT JOIN table2 ON table1.id=table2.id
  WHERE table2.id IS NULL;
join"HEX!LSyntax:
HEX(N_or_S)

If N_or_S is a number, returns a string representation of the
hexadecimal value of N, where N is a longlong (BIGINT) number. This is
equivalent to CONV(N,10,16).

If N_or_S is a string, returns a hexadecimal string representation of
N_or_S where each character in N_or_S is converted to two hexadecimal
digits.
}mysql> SELECT HEX(255);
        -> 'FF'
mysql> SELECT 0x616263;
        -> 'abc'
mysql> SELECT HEX('abc');
        -> 616263
string-functionsD"REPLACE!Syntax:
REPLACE(str,from_str,to_str)

Returns the string str with all occurrences of the string from_str
replaced by the string to_str. REPLACE() performs a case-sensitive
match when searching for from_str.
Qmysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');
        -> 'WwWwWw.mysql.com'
string-functions2CONTAINSOContains(g1,g2)

Returns 1 or 0 to indicate whether g1 completely contains g2.
<functions-that-test-spatial-relationships-between-geometries]"SRID SRID(g)

Returns an integer indicating the Spatial Reference System ID for the
geometry value g.

In MySQL, the SRID value is just an integer associated with the
geometry value. All calculations are done assuming Euclidean (planar)
geometry.
7mysql> SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
+-----------------------------------------------+
| SRID(GeomFromText('LineString(1 1,2 2)',101)) |
+-----------------------------------------------+
|                                           101 |
+-----------------------------------------------+
#general-geometry-property-functions2CURRENT_TIMESTAMPrSyntax:
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP()

CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().
date-and-time-functions2VARIANCESyntax:
VARIANCE(expr)

Returns the population standard variance of expr. This is an extension
to standard SQL. As of MySQL 5.0.3, the standard SQL function VAR_POP()
can be used instead.

VARIANCE() returns NULL if there were no matching rows.
group-by-functions2VAR_SAMPSyntax:
VAR_SAMP(expr)

Returns the sample variance of expr. That is, the denominator is the
number of rows minus one. This function was added in MySQL 5.0.3.

VAR_SAMP() returns NULL if there were no matching rows.
group-by-functions"CONCAT!Syntax:
CONCAT(str1,str2,...)

Returns the string that results from concatenating the arguments. May
have one or more arguments. If all arguments are non-binary strings,
the result is a non-binary string. If the arguments include any binary
strings, the result is a binary string. A numeric argument is converted
to its equivalent binary string form; if you want to avoid that, you
can use an explicit type cast, as in this example:

SELECT CONCAT(CAST(int_col AS CHAR), char_col);

CONCAT() returns NULL if any argument is NULL.
mysql> SELECT CONCAT('My', 'S', 'QL');
        -> 'MySQL'
mysql> SELECT CONCAT('My', NULL, 'QL');
        -> NULL
mysql> SELECT CONCAT(14.3);
        -> '14.3'
string-functions2	GEOMETRY HIERARCHYGeometry is the base class. It is an abstract class. The instantiable
subclasses of Geometry are restricted to zero-, one-, and
two-dimensional geometric objects that exist in two-dimensional
coordinate space. All instantiable geometry classes are defined so that
valid instances of a geometry class are topologically closed (that is,
all defined geometries include their boundary).

The base Geometry class has subclasses for Point, Curve, Surface, and
GeometryCollection:

o Point represents zero-dimensional objects.

o Curve represents one-dimensional objects, and has subclass
  LineString, with sub-subclasses Line and LinearRing.

o Surface is designed for two-dimensional objects and has subclass
  Polygon.

o GeometryCollection has specialized zero-, one-, and two-dimensional
  collection classes named MultiPoint, MultiLineString, and
  MultiPolygon for modeling geometries corresponding to collections of
  Points, LineStrings, and Polygons, respectively. MultiCurve and
  MultiSurface are introduced as abstract superclasses that generalize
  the collection interfaces to handle Curves and Surfaces.

Geometry, Curve, Surface, MultiCurve, and MultiSurface are defined as
non-instantiable classes. They define a common set of methods for their
subclasses and are included for extensibility.

Point, LineString, Polygon, GeometryCollection, MultiPoint,
MultiLineString, and MultiPolygon are instantiable classes.
gis-geometry-class-hierarchy"

CHAR FUNCTION!Syntax:
CHAR(N,... [USING charset_name])

CHAR() interprets each argument N as an integer and returns a string
consisting of the characters given by the code values of those
integers. NULL values are skipped.
As of MySQL 5.0.15, CHAR() arguments larger than 255 are converted into
multiple result bytes. For example, CHAR(256) is equivalent to
CHAR(1,0), and CHAR(256*256) is equivalent to CHAR(1,0,0):

mysql> SELECT HEX(CHAR(1,0)), HEX(CHAR(256));
+----------------+----------------+
| HEX(CHAR(1,0)) | HEX(CHAR(256)) |
+----------------+----------------+
| 0100           | 0100           |
+----------------+----------------+
mysql> SELECT HEX(CHAR(1,0,0)), HEX(CHAR(256*256));
+------------------+--------------------+
| HEX(CHAR(1,0,0)) | HEX(CHAR(256*256)) |
+------------------+--------------------+
| 010000           | 010000             |
+------------------+--------------------+

By default, CHAR() returns a binary string. To produce a string in a
given character set, use the optional USING clause:

mysql> SELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));
+---------------------+--------------------------------+
| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |
+---------------------+--------------------------------+
| binary              | utf8                           |
+---------------------+--------------------------------+

If USING is given and the result string is illegal for the given
character set, a warning is issued. Also, if strict SQL mode is
enabled, the result from CHAR() becomes NULL.

Before MySQL 5.0.15, CHAR() returns a string in the connection
character set and the USING clause is unavailable. In addition, each
argument is interpreted modulo 256, so CHAR(256) and CHAR(256*256) both
are equivalent to CHAR(0).
omysql> SELECT CHAR(77,121,83,81,'76');
        -> 'MySQL'
mysql> SELECT CHAR(77,77.3,'77.3');
        -> 'MMM'
string-functions12DATETIMEDATETIME

A date and time combination. The supported range is '1000-01-01
00:00:00' to '9999-12-31 23:59:59'. MySQL displays DATETIME values in
'YYYY-MM-DD HH:MM:SS' format, but allows you to assign values to
DATETIME columns using either strings or numbers.
date-and-time-type-overview`2OPEN#MSyntax:
OPEN cursor_name

This statement opens a previously declared cursor.
open"
SHOW CREATE PROCEDURESyntax:
SHOW CREATE {PROCEDURE | FUNCTION} sp_name

This statement is a MySQL extension. Similar to SHOW CREATE TABLE, it
returns the exact string that can be used to re-create the named
routine.

mysql> SHOW CREATE FUNCTION test.hello\G
*************************** 1. row ***************************
       Function: hello
       sql_mode:
Create Function: CREATE FUNCTION `test`.`hello`(s CHAR(20)) RETURNS CHAR(50)
                 RETURN CONCAT('Hello, ',s,'!')
show-create-procedurek2INTEGERDINTEGER[(M)] [UNSIGNED] [ZEROFILL]

This type is a synonym for INT.
numeric-type-overview"LOWER!Syntax:
LOWER(str)

Returns the string str with all characters changed to lowercase
according to the current character set mapping. The default is latin1
(cp1252 West European).
Amysql> SELECT LOWER('QUADRATICALLY');
        -> 'quadratically'
string-functions2CREATE TRIGGERSyntax:
CREATE
    [DEFINER = { user | CURRENT_USER }]
    TRIGGER trigger_name trigger_time trigger_event
    ON tbl_name FOR EACH ROW trigger_stmt

This statement creates a new trigger. A trigger is a named database
object that is associated with a table, and that activates when a
particular event occurs for the table. CREATE TRIGGER was added in
MySQL 5.0.2. Currently, its use requires the SUPER privilege.

The trigger becomes associated with the table named tbl_name, which
must refer to a permanent table. You cannot associate a trigger with a
TEMPORARY table or a view.

When the trigger is activated, the DEFINER clause determines the
privileges that apply, as described later in this section.

trigger_time is the trigger action time. It can be BEFORE or AFTER to
indicate that the trigger activates before or after the statement that
activated it.

trigger_event indicates the kind of statement that activates the
trigger. The trigger_event can be one of the following:

o INSERT: The trigger is activated whenever a new row is inserted into
  the table; for example, through INSERT, LOAD DATA, and REPLACE
  statements.

o UPDATE: The trigger is activated whenever a row is modified; for
  example, through UPDATE statements.

o DELETE: The trigger is activated whenever a row is deleted from the
  table; for example, through DELETE and REPLACE statements. However,
  DROP TABLE and TRUNCATE statements on the table do not activate this
  trigger, because they do not use DELETE. See [truncate].
create-trigger	2SHOW COLUMNSSyntax:
SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [LIKE 'pattern']

SHOW COLUMNS displays information about the columns in a given table.
It also works for views as of MySQL 5.0.1.

If the data types differ from what you expect them to be based on your
CREATE TABLE statement, note that MySQL sometimes changes data types
when you create or alter a table. The conditions for which this occurs
are described in [silent-column-changes].

The FULL keyword causes the output to include the privileges you have
as well as any per-column comments for each column.

You can use db_name.tbl_name as an alternative to the tbl_name FROM
db_name syntax. In other words, these two statements are equivalent:

mysql> SHOW COLUMNS FROM mytable FROM mydb;
mysql> SHOW COLUMNS FROM mydb.mytable;

SHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table's
columns with the mysqlshow db_name tbl_name command.

The DESCRIBE statement provides information similar to SHOW COLUMNS.
See [describe].
show-columns"MONTHGSyntax:
MONTH(date)

Returns the month for date, in the range 0 to 12.
0mysql> SELECT MONTH('1998-02-03');
        -> 2
date-and-time-functions2TINYINT{TINYINT[(M)] [UNSIGNED] [ZEROFILL]

A very small integer. The signed range is -128 to 127. The unsigned
range is 0 to 255.
numeric-type-overviewd2
SHOW TRIGGERS?Syntax:
SHOW TRIGGERS [FROM db_name] [LIKE expr]

SHOW TRIGGERS lists the triggers currently defined on the MySQL server.
This statement requires the SUPER privilege. It was implemented in
MySQL 5.0.10.

For the trigger ins_sum as defined in [using-triggers], the output of
this statement is as shown here:

mysql> SHOW TRIGGERS LIKE 'acc%'\G
*************************** 1. row ***************************
  Trigger: ins_sum
    Event: INSERT
    Table: account
Statement: SET @sum = @sum + NEW.amount
   Timing: BEFORE
  Created: NULL
 sql_mode:
  Definer: myname@localhost

show-triggers2MASTER_POS_WAIT
Syntax:
MASTER_POS_WAIT(log_name,log_pos[,timeout])

This function is useful for control of master/slave synchronization. It
blocks until the slave has read and applied all updates up to the
specified position in the master log. The return value is the number of
log events the slave had to wait for to advance to the specified
position. The function returns NULL if the slave SQL thread is not
started, the slave's master information is not initialized, the
arguments are incorrect, or an error occurs. It returns -1 if the
timeout has been exceeded. If the slave SQL thread stops while
MASTER_POS_WAIT() is waiting, the function returns NULL. If the slave
is past the specified position, the function returns immediately.
miscellaneous-functions?"REGEXP!Syntax:
expr REGEXP pat expr RLIKE pat

Performs a pattern match of a string expression expr against a pattern
pat. The pattern can be an extended regular expression. The syntax for
regular expressions is discussed in [regexp]. Returns 1 if expr matches
pat; otherwise it returns 0. If either expr or pat is NULL, the result
is NULL. RLIKE is a synonym for REGEXP, provided for mSQL
compatibility.

The pattern need not be a literal string. For example, it can be
specified as a string expression or table column.

Note: Because MySQL uses the C escape syntax in strings (for example,
`\n' to represent the newline character), you must double any `\' that
you use in your REGEXP strings.

REGEXP is not case sensitive, except when used with binary strings.
mysql> SELECT 'Monty!' REGEXP 'm%y%%';
        -> 0
mysql> SELECT 'Monty!' REGEXP '.*';
        -> 1
mysql> SELECT 'new*\n*line' REGEXP 'new\\*.\\*line';
        -> 1
mysql> SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A';
        -> 1  0
mysql> SELECT 'a' REGEXP '^[a-d]';
        -> 1
string-comparison-functions92IF STATEMENT#Syntax:
IF search_condition THEN statement_list
    [ELSEIF search_condition THEN statement_list] ...
    [ELSE statement_list]
END IF

IF implements a basic conditional construct. If the search_condition
evaluates to true, the corresponding SQL statement list is executed. If
no search_condition matches, the statement list in the ELSE clause is
executed. Each statement_list consists of one or more statements.

Note: There is also an IF() function, which differs from the IF
statement described here. See [control-flow-functions].
if-statement"^Syntax:
^

Bitwise XOR:
gmysql> SELECT 1 ^ 1;
        -> 0
mysql> SELECT 1 ^ 0;
        -> 1
mysql> SELECT 11 ^ 3;
        -> 8

bit-functions2	DROP VIEW$Syntax:
DROP VIEW [IF EXISTS]
    view_name [, view_name] ...
    [RESTRICT | CASCADE]

DROP VIEW removes one or more views. You must have the DROP privilege
for each view.

The IF EXISTS clause prevents an error from occurring for views that
don't exist. When this clause is given, a NOTE is generated for each
non-existent view. See [show-warnings].

RESTRICT and CASCADE, if given, are parsed and ignored.
	drop-view-"DATE OPERATIONSSyntax:
DATE_ADD(date,INTERVAL expr type), DATE_SUB(date,INTERVAL expr type)

These functions perform date arithmetic. date is a DATETIME or DATE
value specifying the starting date. expr is an expression specifying
the interval value to be added or subtracted from the starting date.
expr is a string; it may start with a `-' for negative intervals. type
is a keyword indicating how the expression should be interpreted.
Umysql> SELECT '1997-12-31 23:59:59' + INTERVAL 1 SECOND;
        -> '1998-01-01 00:00:00'
mysql> SELECT INTERVAL 1 DAY + '1997-12-31';
        -> '1998-01-01'
mysql> SELECT '1998-01-01' - INTERVAL 1 SECOND;
        -> '1997-12-31 23:59:59'
mysql> SELECT DATE_ADD('1997-12-31 23:59:59',
    ->                 INTERVAL 1 SECOND);
        -> '1998-01-01 00:00:00'
mysql> SELECT DATE_ADD('1997-12-31 23:59:59',
    ->                 INTERVAL 1 DAY);
        -> '1998-01-01 23:59:59'
mysql> SELECT DATE_ADD('1997-12-31 23:59:59',
    ->                 INTERVAL '1:1' MINUTE_SECOND);
        -> '1998-01-01 00:01:00'
mysql> SELECT DATE_SUB('1998-01-01 00:00:00',
    ->                 INTERVAL '1 1:1:1' DAY_SECOND);
        -> '1997-12-30 22:58:59'
mysql> SELECT DATE_ADD('1998-01-01 00:00:00',
    ->                 INTERVAL '-1 10' DAY_HOUR);
        -> '1997-12-30 14:00:00'
mysql> SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY);
        -> '1997-12-02'
mysql> SELECT DATE_ADD('1992-12-31 23:59:59.000002',
    ->            INTERVAL '1.999999' SECOND_MICROSECOND);
        -> '1993-01-01 00:00:01.000001'
date-and-time-functions2WITHINMWithin(g1,g2)

Returns 1 or 0 to indicate whether g1 is spatially within g2.
<functions-that-test-spatial-relationships-between-geometriesh"WEEK}Syntax:
WEEK(date[,mode])

This function returns the week number for date. The two-argument form
of WEEK() allows you to specify whether the week starts on Sunday or
Monday and whether the return value should be in the range from 0 to 53
or from 1 to 53. If the mode argument is omitted, the value of the
default_week_format system variable is used. See
[server-system-variables].
mysql> SELECT WEEK('1998-02-20');
        -> 7
mysql> SELECT WEEK('1998-02-20',0);
        -> 7
mysql> SELECT WEEK('1998-02-20',1);
        -> 8
mysql> SELECT WEEK('1998-12-31',1);
        -> 53
date-and-time-functions2PREPARE~Syntax:
PREPARE stmt_name FROM preparable_stmt

The PREPARE statement prepares a statement and assigns it a name,
stmt_name, by which to refer to the statement later. Statement names
are not case sensitive. preparable_stmt is either a string literal or a
user variable that contains the text of the statement. The text must
represent a single SQL statement, not multiple statements. Within the
statement, `?' characters can be used as parameter markers to indicate
where data values are to be bound to the query later when you execute
it. The `?' characters should not be enclosed within quotes, even if
you intend to bind them to string values. Parameter markers can be used
only where data values should appear, not for SQL keywords,
identifiers, and so forth.

If a prepared statement with the given name already exists, it is
deallocated implicitly before the new statement is prepared. This means
that if the new statement contains an error and cannot be prepared, an
error is returned and no statement with the given name exists.

The scope of a prepared statement is the client session within which it
is created. Other clients cannot see it.
sqlps2LOCKSyntax:
LOCK TABLES
    tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}
    [, tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}] ...
UNLOCK TABLES

LOCK TABLES locks tables for the current thread. If any of the tables
are locked by other threads, it blocks until all locks can be acquired.
UNLOCK TABLES releases any locks held by the current thread. All tables
that are locked by the current thread are implicitly unlocked when the
thread issues another LOCK TABLES, or when the connection to the server
is closed.

A table lock protects only against inappropriate reads or writes by
other clients. The client holding the lock, even a read lock, can
perform table-level operations such as DROP TABLE.
lock-tables2RESET SLAVESyntax:
RESET SLAVE

RESET SLAVE makes the slave forget its replication position in the
master's binary logs. This statement is meant to be used for a clean
start: It deletes the master.info and relay-log.info files, all the
relay logs, and starts a new relay log.

Note: All relay logs are deleted, even if they have not been completely
executed by the slave SQL thread. (This is a condition likely to exist
on a replication slave if you have issued a STOP SLAVE statement or if
the slave is highly loaded.)

Connection information stored in the master.info file is immediately
reset using any values specified in the corresponding startup options.
This information includes values such as master host, master port,
master user, and master password. If the slave SQL thread was in the
middle of replicating temporary tables when it was stopped, and RESET
SLAVE is issued, these replicated temporary tables are deleted on the
slave.
reset-slave2 POLYGONPolygon(ls1,ls2,...)

Constructs a WKB Polygon value from a number of WKB LineString
arguments. If any argument does not represent the WKB of a LinearRing
(that is, not a closed and simple LineString) the return value is NULL.
gis-mysql-specific-functions"!MINUTEISyntax:
MINUTE(time)

Returns the minute for time, in the range 0 to 59.
8mysql> SELECT MINUTE('98-02-03 10:05:03');
        -> 5
date-and-time-functions]2"DAY8Syntax:
DAY(date)

DAY() is a synonym for DAYOFMONTH().
date-and-time-functionsr2#MID!TSyntax:
MID(str,pos,len)

MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).
string-functions2$REPLACE INTOSyntax:
REPLACE [LOW_PRIORITY | DELAYED]
    [INTO] tbl_name [(col_name,...)]
    VALUES ({expr | DEFAULT},...),(...),...

Or:

REPLACE [LOW_PRIORITY | DELAYED]
    [INTO] tbl_name
    SET col_name={expr | DEFAULT}, ...

Or:

REPLACE [LOW_PRIORITY | DELAYED]
    [INTO] tbl_name [(col_name,...)]
    SELECT ...

REPLACE works exactly like INSERT, except that if an old row in the
table has the same value as a new row for a PRIMARY KEY or a UNIQUE
index, the old row is deleted before the new row is inserted. See
[insert].

REPLACE is a MySQL extension to the SQL standard. It either inserts, or
deletes and inserts. If you're looking for a statement that follows the
SQL standard, and that either inserts or updates, see
[insert-on-duplicate].

Note that unless the table has a PRIMARY KEY or UNIQUE index, using a
REPLACE statement makes no sense. It becomes equivalent to INSERT,
because there is no index to be used to determine whether a new row
duplicates another.

Values for all columns are taken from the values specified in the
REPLACE statement. Any missing columns are set to their default values,
just as happens for INSERT. You cannot refer to values from the current
row and use them in the new row. If you use an assignment such as SET
col_name = col_name + 1, the reference to the column name on the right
hand side is treated as DEFAULT(col_name), so the assignment is
equivalent to SET col_name = DEFAULT(col_name) + 1.

To use REPLACE, you must have both the INSERT and DELETE privileges for
the table.
replace5"%UUID
Syntax:
UUID()

Returns a Universal Unique Identifier (UUID) generated according to
"DCE 1.1: Remote Procedure Call" (Appendix A) CAE (Common Applications
Environment) Specifications published by The Open Group in October 1997
(Document Number C706,
http://www.opengroup.org/public/pubs/catalog/c706.htm).

A UUID is designed as a number that is globally unique in space and
time. Two calls to UUID() are expected to generate two different
values, even if these calls are performed on two separate computers
that are not connected to each other.

A UUID is a 128-bit number represented by a string of five hexadecimal
numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:

o The first three numbers are generated from a timestamp.

o The fourth number preserves temporal uniqueness in case the timestamp
  value loses monotonicity (for example, due to daylight saving time).

o 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.
Hmysql> SELECT UUID();
        -> '6ccd780c-baba-1026-9564-0040f4311e29'
miscellaneous-functions2&
LINESTRINGLineString(pt1,pt2,...)

Constructs a WKB LineString value from a number of WKB Point arguments.
If any argument is not a WKB Point, the return value is NULL. If the
number of Point arguments is less than two, the return value is NULL.
gis-mysql-specific-functions+2'SLEEP
Syntax:
SLEEP(duration)

Sleeps (pauses) for the number of seconds given by the duration
argument, then returns 0. If SLEEP() is interrupted, it returns 1. The
duration may have a fractional part given in microseconds. This
function was added in MySQL 5.0.12.
miscellaneous-functions
"(
CONNECTION_IDSyntax:
CONNECTION_ID()

Returns the connection ID (thread ID) for the connection. Every
connection has an ID that is unique among the set of currently
connected clients.
0mysql> SELECT CONNECTION_ID();
        -> 23786
information-functionsT2)DELETE=Syntax:
Single-table syntax:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
    [WHERE where_condition]
    [ORDER BY ...]
    [LIMIT row_count]

Multiple-table syntax:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
    tbl_name[.*] [, tbl_name[.*]] ...
    FROM table_references
    [WHERE where_condition]

Or:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
    FROM tbl_name[.*] [, tbl_name[.*]] ...
    USING table_references
    [WHERE where_condition]

For the single-table syntax, the DELETE statement deletes rows from
tbl_name and returns the number of rows deleted. The WHERE clause, if
given, specifies the conditions that identify which rows to delete.
With no WHERE clause, all rows are deleted. If the ORDER BY clause is
specified, the rows are deleted in the order that is specified. The
LIMIT clause places a limit on the number of rows that can be deleted.

For the multiple-table syntax, DELETE deletes from each tbl_name the
rows that satisfy the conditions. In this case, ORDER BY and LIMIT
cannot be used.

where_condition is an expression that evaluates to true for each row to
be deleted. It is specified as described in [select].

As stated, a DELETE statement with no WHERE clause deletes all rows. A
faster way to do this, when you do not want to know the number of
deleted rows, is to use TRUNCATE TABLE. See [truncate].
delete"*ROUNDSyntax:
ROUND(X), ROUND(X,D)

Returns the argument X, rounded to the nearest integer. With two
arguments, returns X rounded to D decimal places. D can be negative to
cause D digits left of the decimal point of the value X to become zero.
mysql> SELECT ROUND(-1.23);
        -> -1
mysql> SELECT ROUND(-1.58);
        -> -2
mysql> SELECT ROUND(1.58);
        -> 2
mysql> SELECT ROUND(1.298, 1);
        -> 1.3
mysql> SELECT ROUND(1.298, 0);
        -> 1
mysql> SELECT ROUND(23.298, -1);
        -> 20
mathematical-functions"+NULLIFSyntax:
NULLIF(expr1,expr2)

Returns NULL if expr1 = expr2 is true, otherwise returns expr1. This is
the same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.
Smysql> SELECT NULLIF(1,1);
        -> NULL
mysql> SELECT NULLIF(1,2);
        -> 1
control-flow-functions2,CLOSE#Syntax:
CLOSE cursor_name

This statement closes a previously opened cursor.

If not closed explicitly, a cursor is closed at the end of the compound
statement in which it was declared.
closeB2-
STOP SLAVE#Syntax:
STOP SLAVE [thread_type [, thread_type] ... ]

thread_type: IO_THREAD | SQL_THREAD

Stops the slave threads. STOP SLAVE requires the SUPER privilege.

Like START SLAVE, this statement may be used with the IO_THREAD and
SQL_THREAD options to name the thread or threads to be stopped.

stop-slave".TIMEDIFFSyntax:
TIMEDIFF(expr,expr2)

TIMEDIFF() returns the time between the start time expr and the end
time expr2. expr and expr2 are time or date-and-time expressions, but
both must be of the same type.

mysql> SELECT TIMEDIFF('2000:01:01 00:00:00',
    ->                 '2000:01:01 00:00:00.000001');
        -> '-00:00:00.000001'
mysql> SELECT TIMEDIFF('1997-12-31 23:59:59.000001',
    ->                 '1997-12-30 01:01:01.000002');
        -> '46:58:57.999999'
date-and-time-functions2/LINEFROMTEXTLineFromText(wkt[,srid]), LineStringFromText(wkt[,srid])

Constructs a LINESTRING value using its WKT representation and SRID.
gis-wkt-functions20SHOW MASTER STATUSSyntax:
SHOW MASTER STATUS

Provides status information about the binary log files of the master.
Example:

mysql > SHOW MASTER STATUS;
+---------------+----------+--------------+------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+---------------+----------+--------------+------------------+
| mysql-bin.003 | 73       | test         | manual,mysql     |
+---------------+----------+--------------+------------------+
show-master-status"1ADDTIMESyntax:
ADDTIME(expr,expr2)

ADDTIME() adds expr2 to expr and returns the result. expr is a time or
datetime expression, and expr2 is a time expression.
mysql> SELECT ADDTIME('1997-12-31 23:59:59.999999',
    ->                '1 1:1:1.000002');
        -> '1998-01-02 01:01:01.000001'
mysql> SELECT ADDTIME('01:00:00.999999', '02:00:00.999998');
        -> '03:00:01.999997'
date-and-time-functionsn22SPATIALDMySQL can create spatial indexes using syntax similar to that for
creating regular indexes, but extended with the SPATIAL keyword.
Currently, spatial columns that are indexed must be declared NOT NULL.
The following examples demonstrate how to create spatial indexes:

o With CREATE TABLE:

CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g));

o With ALTER TABLE:

ALTER TABLE geom ADD SPATIAL INDEX(g);

o With CREATE INDEX:

CREATE SPATIAL INDEX sp_index ON geom (g);

For MyISAM tables, SPATIAL INDEX creates an R-tree index. For other
storage engines that support spatial indexing, SPATIAL INDEX creates a
B-tree index. A B-tree index on spatial values will be useful for
exact-value lookups, but not for range scans.

To drop spatial indexes, use ALTER TABLE or DROP INDEX:

o With ALTER TABLE:

ALTER TABLE geom DROP INDEX g;

o With DROP INDEX:

DROP INDEX sp_index ON geom;

Example: Suppose that a table geom contains more than 32,000
geometries, which are stored in the column g of type GEOMETRY. The
table also has an AUTO_INCREMENT column fid for storing object ID
values.
creating-spatial-indexes"3
TIMESTAMPDIFFSSyntax:
TIMESTAMPDIFF(interval,datetime_expr1,datetime_expr2)

Returns the integer difference between the date or datetime expressions
datetime_expr1 and datetime_expr2. The unit for the result is given by
the interval argument. The legal values for interval are the same as
those listed in the description of the TIMESTAMPADD() function.
mysql> SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
        -> 3
mysql> SELECT TIMESTAMPDIFF(YEAR,'2002-05-01','2001-01-01');
        -> -1
date-and-time-functions"4UPPER!Syntax:
UPPER(str)

Returns the string str with all characters changed to uppercase
according to the current character set mapping. The default is latin1
(cp1252 West European).
-mysql> SELECT UPPER('Hej');
        -> 'HEJ'
string-functions^"5
FROM_UNIXTIMESyntax:
FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)

Returns a representation of the unix_timestamp argument as a value in
'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether
the function is used in a string or numeric context. unix_timestamp is
an internal timestamp value such as is produced by the UNIX_TIMESTAMP()
function.

If format is given, the result is formatted according to the format
string, which is used the same way as listed in the entry for the
DATE_FORMAT() function.
mysql> SELECT FROM_UNIXTIME(875996580);
        -> '1997-10-04 22:23:00'
mysql> SELECT FROM_UNIXTIME(875996580) + 0;
        -> 19971004222300
mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),
    ->                      '%Y %D %M %h:%i:%s %x');
        -> '2003 6th August 06:22:58 2003'
date-and-time-functionsx26
MEDIUMBLOBOMEDIUMBLOB

A BLOB column with a maximum length of 16,777,215 (224 - 1) bytes.
string-type-overview"7IFNULLSyntax:
IFNULL(expr1,expr2)

If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns
expr2. IFNULL() returns a numeric or string value, depending on the
context in which it is used.
mysql> SELECT IFNULL(1,0);
        -> 1
mysql> SELECT IFNULL(NULL,10);
        -> 10
mysql> SELECT IFNULL(1/0,10);
        -> 10
mysql> SELECT IFNULL(1/0,'yes');
        -> 'yes'
control-flow-functions28SHOW ERRORSSyntax:
SHOW ERRORS [LIMIT [offset,] row_count]
SHOW COUNT(*) ERRORS

This statement is similar to SHOW WARNINGS, except that instead of
displaying errors, warnings, and notes, it displays only errors.

The LIMIT clause has the same syntax as for the SELECT statement. See
[select].

The SHOW COUNT(*) ERRORS statement displays the number of errors. You
can also retrieve this number from the error_count variable:

SHOW COUNT(*) ERRORS;
SELECT @@error_count;
show-errors"9LEASTSyntax:
LEAST(value1,value2,...)

With two or more arguments, returns the smallest (minimum-valued)
argument. The arguments are compared using the following rules:

o If the return value is used in an INTEGER context or all arguments
  are integer-valued, they are compared as integers.

o If the return value is used in a REAL context or all arguments are
  real-valued, they are compared as reals.

o If any argument is a case-sensitive string, the arguments are
  compared as case-sensitive strings.

o In all other cases, the arguments are compared as case-insensitive
  strings.

Before MySQL 5.0.13, LEAST() returns NULL only if all arguments are
NULL. As of 5.0.13, it returns NULL if any argument is NULL.
mysql> SELECT LEAST(2,0);
        -> 0
mysql> SELECT LEAST(34.0,3.0,5.0,767.0);
        -> 3.0
mysql> SELECT LEAST('B','A','C');
        -> 'A'
comparison-operators":=
=

Equal:
mysql> SELECT 1 = 0;
        -> 0
mysql> SELECT '0' = 0;
        -> 1
mysql> SELECT '0.0' = 0;
        -> 1
mysql> SELECT '0.01' = 0;
        -> 0
mysql> SELECT '.01' = 0.01;
        -> 1
comparison-operators";REVERSE!XSyntax:
REVERSE(str)

Returns the string str with the order of the characters reversed.
/mysql> SELECT REVERSE('abc');
        -> 'cba'
string-functions"<ISNULLSSyntax:
ISNULL(expr)

If expr is NULL, ISNULL() returns 1, otherwise it returns 0.
Pmysql> SELECT ISNULL(1+1);
        -> 0
mysql> SELECT ISNULL(1/0);
        -> 1
comparison-operators2=BINARYBINARY(M)

The BINARY type is similar to the CHAR type, but stores binary byte
strings rather than non-binary character strings.
string-type-overview
2>BLOB DATA TYPEA BLOB is a binary large object that can hold a variable amount of
data. The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB.
These differ only in the maximum length of the values they can hold.
The four TEXT types are TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These
correspond to the four BLOB types and have the same maximum lengths and
storage requirements. See [storage-requirements]. No lettercase
conversion for TEXT or BLOB columns takes place during storage or
retrieval.
blob2?BOUNDARY kBoundary(g)

Returns a geometry that is the closure of the combinatorial boundary of
the geometry value g.
#general-geometry-property-functionsP2@CREATE USER/Syntax:
CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']
    [, user [IDENTIFIED BY [PASSWORD] 'password']] ...

The CREATE USER statement was added in MySQL 5.0.2. This statement
creates new MySQL accounts. To use it, you must have the global CREATE
USER privilege or the INSERT privilege for the mysql database. For each
account, CREATE USER creates a new record in the mysql.user table that
has no privileges. An error occurs if the account already exists. Each
account is named using the same format as for the GRANT statement; for
example, 'jeffrey'@'localhost'. The user and host parts of the account
name correspond to the User and Host column values of the user table
row for the account.

The account can be given a password with the optional IDENTIFIED BY
clause. The user value and the password are given the same way as for
the GRANT statement. In particular, to specify the password in plain
text, omit the PASSWORD keyword. To specify the password as the hashed
value as returned by the PASSWORD() function, include the PASSWORD
keyword. See [grant].
create-userf2APOINT:Point(x,y)

Constructs a WKB Point using its coordinates.
gis-mysql-specific-functions"BCURRENT_USERSyntax:
CURRENT_USER, CURRENT_USER()

Returns the username and hostname combination for the MySQL account
that the server used to authenticate the current client. This account
determines your access privileges. As of MySQL 5.0.10, within a stored
routine that is defined with the SQL SECURITY DEFINER characteristic,
CURRENT_USER() returns the creator of the routine. The return value is
a string in the utf8 character set.

The value of CURRENT_USER() can differ from the value of USER().
mysql> SELECT USER();
        -> 'davida@localhost'
mysql> SELECT * FROM mysql.user;
ERROR 1044: Access denied for user ''@'localhost' to
database 'mysql'
mysql> SELECT CURRENT_USER();
        -> '@localhost'
information-functionsV2CLCASE!6Syntax:
LCASE(str)

LCASE() is a synonym for LOWER().
string-functionsh"D<= Syntax:
<=

Less than or equal:
%mysql> SELECT 0.1 <= 2;
        -> 1
comparison-operatorsr2EUPDATE[Syntax:
Single-table syntax:

UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
    SET col_name1=expr1 [, col_name2=expr2 ...]
    [WHERE where_condition]
    [ORDER BY ...]
    [LIMIT row_count]

Multiple-table syntax:

UPDATE [LOW_PRIORITY] [IGNORE] table_references
    SET col_name1=expr1 [, col_name2=expr2 ...]
    [WHERE where_condition]

For the single-table syntax, the UPDATE statement updates columns of
existing rows in tbl_name with new values. The SET clause indicates
which columns to modify and the values they should be given. The WHERE
clause, if given, specifies the conditions that identify which rows to
update. With no WHERE clause, all rows are updated. If the ORDER BY
clause is specified, the rows are updated in the order that is
specified. The LIMIT clause places a limit on the number of rows that
can be updated.

For the multiple-table syntax, UPDATE updates rows in each table named
in table_references that satisfy the conditions. In this case, ORDER BY
and LIMIT cannot be used.

where_condition is an expression that evaluates to true for each row to
be updated. It is specified as described in [select].

The UPDATE statement supports the following modifiers:

o If you use the LOW_PRIORITY keyword, execution of the UPDATE is
  delayed until no other clients are reading from the table.

o If you use the IGNORE keyword, the update statement does not abort
  even if errors occur during the update. Rows for which duplicate-key
  conflicts occur are not updated. Rows for which columns are updated
  to values that would cause data conversion errors are updated to the
  closet valid values instead.
update2FCASE STATEMENT#qSyntax:
CASE case_value
    WHEN when_value THEN statement_list
    [WHEN when_value THEN statement_list] ...
    [ELSE statement_list]
END CASE

Or:

CASE
    WHEN search_condition THEN statement_list
    [WHEN search_condition THEN statement_list] ...
    [ELSE statement_list]
END CASE

The CASE statement for stored routines implements a complex conditional
construct. If a search_condition evaluates to true, the corresponding
SQL statement list is executed. If no search condition matches, the
statement list in the ELSE clause is executed. Each statement_list
consists of one or more statements.

Note: The syntax of the CASE statement shown here for use inside stored
routines differs slightly from that of the SQL CASE expression
described in [control-flow-functions]. The CASE statement cannot have
an ELSE NULL clause, and it is terminated with END CASE instead of END.
case-statement2GEXECUTE STATEMENTSyntax:
EXECUTE stmt_name [USING @var_name [, @var_name] ...]

After preparing a statement, you execute it with an EXECUTE statement
that refers to the prepared statement name. If the prepared statement
contains any parameter markers, you must supply a USING clause that
lists user variables containing the values to be bound to the
parameters. Parameter values can be supplied only by user variables,
and the USING clause must name exactly as many variables as the number
of parameter markers in the statement.

You can execute a given prepared statement multiple times, passing
different variables to it or setting the variables to different values
before each execution.
sqlps2H
DROP INDEX$Syntax:
DROP INDEX index_name ON tbl_name

DROP INDEX drops the index named index_name from the table tbl_name.
This statement is mapped to an ALTER TABLE statement to drop the index.
See [alter-table].

drop-index6"I
MATCH AGAINST!	Syntax:
MATCH (col1,col2,...) AGAINST (expr [search_modifier])

search_modifier: { IN BOOLEAN MODE | WITH QUERY EXPANSION }

MySQL has support for full-text indexing and searching:

o A full-text index in MySQL is an index of type FULLTEXT.

o Full-text indexes can be used only with MyISAM tables, and can be
  created only for CHAR, VARCHAR, or TEXT columns.

o A FULLTEXT index definition can be given in the CREATE TABLE
  statement when a table is created, or added later using ALTER TABLE
  or CREATE INDEX.

o For large datasets, it is much faster to load your data into a table
  that has no FULLTEXT index and then create the index after that, than
  to load data into a table that has an existing FULLTEXT index.

Full-text searching is performed using MATCH() ... AGAINST syntax.
MATCH() takes a comma-separated list that names the columns to be
searched. AGAINST takes a string to search for, and an optional
modifier that indicates what type of search to perform. The search
string must be a literal string, not a variable or a column name. There
are three types of full-text searches:

o A boolean search interprets the search string using the rules of a
  special query language. The string contains the words to search for.
  It can also contain operators that specify requirements such that a
  word must be present or absent in matching rows, or that it should be
  weighted higher or lower than usual. Common words such as "some" or
  "then" are stopwords and do not match if present in the search
  string. The IN BOOLEAN MODE modifier specifies a boolean search. For
  more information, see [fulltext-boolean].

o A natural language search interprets the search string as a phrase in
  natural human language (a phrase in free text). There are no special
  operators. The stopword list applies. In addition, words that are
  present in more than 50% of the rows are considered common and do not
  match. Full-text searches are natural language searches if no
  modifier is given.

o A query expansion search is a modification of a natural language
  search. The search string is used to perform a natural language
  search. Then words from the most relevant rows returned by the search
  are added to the search string and the search is done again. The
  query returns the rows from the second search. The WITH QUERY
  EXPANSION modifier specifies a query expansion search. For more
  information, see [fulltext-query-expansion].
zmysql> SELECT id, body, MATCH (title,body) AGAINST
    -> ('Security implications of running MySQL as root') AS score
    -> FROM articles WHERE MATCH (title,body) AGAINST
    -> ('Security implications of running MySQL as root');
+----+-------------------------------------+-----------------+
| id | body                                | score           |
+----+-------------------------------------+-----------------+
|  4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |
|  6 | When configured properly, MySQL ... | 1.3114095926285 |
+----+-------------------------------------+-----------------+
2 rows in set (0.00 sec)
fulltext-search"JABS1Syntax:
ABS(X)

Returns the absolute value of X.
Imysql> SELECT ABS(2);
        -> 2
mysql> SELECT ABS(-32);
        -> 32
mathematical-functions2KPOLYFROMWKBwPolyFromWKB(wkb[,srid]), PolygonFromWKB(wkb[,srid])

Constructs a POLYGON value using its WKB representation and SRID.
gis-wkb-functions2LNOT LIKE!rSyntax:
expr NOT LIKE pat [ESCAPE 'escape_char']

This is the same as NOT (expr LIKE pat [ESCAPE 'escape_char']).
string-comparison-functions"MSPACE!ESyntax:
SPACE(N)

Returns a string consisting of N space characters.
,mysql> SELECT SPACE(6);
        -> '      '
string-functions"NMBR DEFINITIONIts MBR (Minimum Bounding Rectangle), or Envelope. This is the bounding
geometry, formed by the minimum and maximum (X,Y) coordinates:
:((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))
gis-class-geometry2OGEOMETRYCOLLECTIONGeometryCollection(g1,g2,...)

Constructs a WKB GeometryCollection. If any argument is not a
well-formed WKB representation of a geometry, the return value is NULL.
gis-mysql-specific-functions"P*Syntax:
*

Multiplication:
mysql> SELECT 3*5;
        -> 15
mysql> SELECT 18014398509481984*18014398509481984.0;
        -> 324518553658426726783156020576256.0
mysql> SELECT 18014398509481984*18014398509481984;
        -> 0
arithmetic-functions2Q	TIMESTAMPTIMESTAMP

A timestamp. The range is '1970-01-01 00:00:00' to partway through the
year 2037.

A TIMESTAMP column is useful for recording the date and time of an
INSERT or UPDATE operation. By default, the first TIMESTAMP column in a
table is automatically set to the date and time of the most recent
operation if you do not assign it a value yourself. You can also set
any TIMESTAMP column to the current date and time by assigning it a
NULL value. Variations on automatic initialization and update
properties are described in [timestamp-4-1].

A TIMESTAMP value is returned as a string in the format 'YYYY-MM-DD
HH:MM:SS' with a display width fixed at 19 characters. To obtain the
value as a number, you should add +0 to the timestamp column.

Note: The TIMESTAMP format that was used prior to MySQL 4.1 is not
supported in MySQL 5.0; see MySQL 3.23, 4.0, 4.1 Reference Manual for
information regarding the old format.
date-and-time-type-overviewf2RDES_DECRYPT
<Syntax:
DES_DECRYPT(crypt_str[,key_str])

Decrypts a string encrypted with DES_ENCRYPT(). If an error occurs,
this function returns NULL.

Note that this function works only if MySQL has been configured with
SSL support. See [secure-connections].

If no key_str argument is given, DES_DECRYPT() examines the first byte
of the encrypted string to determine the DES key number that was used
to encrypt the original string, and then reads the key from the DES key
file to decrypt the message. For this to work, the user must have the
SUPER privilege. The key file can be specified with the --des-key-file
server option.

If you pass this function a key_str argument, that string is used as
the key for decrypting the message.

If the crypt_str argument does not appear to be an encrypted string,
MySQL returns the given crypt_str.
encryption-functions"SENDPOINTQEndPoint(ls)

Returns the Point that is the endpoint of the LineString value ls.
'mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
mysql> SELECT AsText(EndPoint(GeomFromText(@ls)));
+-------------------------------------+
| AsText(EndPoint(GeomFromText(@ls))) |
+-------------------------------------+
| POINT(3 3)                          |
+-------------------------------------+
linestring-property-functions?2TCACHE INDEXSyntax:
CACHE INDEX
  tbl_index_list [, tbl_index_list] ...
  IN key_cache_name

tbl_index_list:
  tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]

The CACHE INDEX statement assigns table indexes to a specific key
cache. It is used only for MyISAM tables.

The following statement assigns indexes from the tables t1, t2, and t3
to the key cache named hot_cache:

mysql> CACHE INDEX t1, t2, t3 IN hot_cache;
+---------+--------------------+----------+----------+
| Table   | Op                 | Msg_type | Msg_text |
+---------+--------------------+----------+----------+
| test.t1 | assign_to_keycache | status   | OK       |
| test.t2 | assign_to_keycache | status   | OK       |
| test.t3 | assign_to_keycache | status   | OK       |
+---------+--------------------+----------+----------+
cache-index5"UCOMPRESS
*Syntax:
COMPRESS(string_to_compress)

Compresses a string and returns the result as a binary string. This
function requires MySQL to have been compiled with a compression
library such as zlib. Otherwise, the return value is always NULL. The
compressed string can be uncompressed with UNCOMPRESS().
mysql> SELECT LENGTH(COMPRESS(REPEAT('a',1000)));
        -> 21
mysql> SELECT LENGTH(COMPRESS(''));
        -> 0
mysql> SELECT LENGTH(COMPRESS('a'));
        -> 13
mysql> SELECT LENGTH(COMPRESS(REPEAT('a',16)));
        -> 15
encryption-functionsR2VINSERT;Syntax:
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
    [INTO] tbl_name [(col_name,...)]
    VALUES ({expr | DEFAULT},...),(...),...
    [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]

Or:

INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
    [INTO] tbl_name
    SET col_name={expr | DEFAULT}, ...
    [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]

Or:

INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
    [INTO] tbl_name [(col_name,...)]
    SELECT ...
    [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]

INSERT inserts new rows into an existing table. The INSERT ... VALUES
and INSERT ... SET forms of the statement insert rows based on
explicitly specified values. The INSERT ... SELECT form inserts rows
selected from another table or tables. INSERT ... SELECT is discussed
further in [insert-select].
insert"WCOUNTSyntax:
COUNT(expr)

Returns a count of the number of non-NULL values in the rows retrieved
by a SELECT statement. The result is a BIGINT value.

COUNT() returns 0 if there were no matching rows.
mysql> SELECT student.student_name,COUNT(*)
    ->        FROM student,course
    ->        WHERE student.student_id=course.student_id
    ->        GROUP BY student_name;
group-by-functions2XHANDLERSyntax:
HANDLER tbl_name OPEN [ AS alias ]
HANDLER tbl_name READ index_name { = | >= | <= | < } (value1,value2,...)
    [ WHERE where_condition ] [LIMIT ... ]
HANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }
    [ WHERE where_condition ] [LIMIT ... ]
HANDLER tbl_name READ { FIRST | NEXT }
    [ WHERE where_condition ] [LIMIT ... ]
HANDLER tbl_name CLOSE

The HANDLER statement provides direct access to table storage engine
interfaces. It is available for MyISAM and InnoDB tables.
handler2Y
MLINEFROMTEXTMLineFromText(wkt[,srid]), MultiLineStringFromText(wkt[,srid])

Constructs a MULTILINESTRING value using its WKT representation and
SRID.
gis-wkt-functions2ZGEOMCOLLFROMWKBGeomCollFromWKB(wkb[,srid]), GeometryCollectionFromWKB(wkb[,srid])

Constructs a GEOMETRYCOLLECTION value using its WKB representation and
SRID.
gis-wkb-functions"[RENAME TABLE$Syntax:
RENAME TABLE tbl_name TO new_tbl_name
    [, tbl_name2 TO new_tbl_name2] ...

This statement renames one or more tables.

The rename operation is done atomically, which means that no other
thread can access any of the tables while the rename is running. For
example, if you have an existing table old_table, you can create
another table new_table that has the same structure but is empty, and
then replace the existing table with the empty one as follows (assuming
that backup_table does not already exist):
^CREATE TABLE new_table (...);
RENAME TABLE old_table TO backup_table, new_table TO old_table;
rename-table2\BOOLEANBOOL, BOOLEAN

These types are synonyms for TINYINT(1). A value of zero is considered
false. Non-zero values are considered true.

In the future, full boolean type handling will be introduced in
accordance with standard SQL.
numeric-type-overview"]DEFAULT
Syntax:
DEFAULT(col_name)

Returns the default value for a table column. Starting with MySQL
5.0.2, an error results if the column has no default value.
5mysql> UPDATE t SET i = DEFAULT(i)+1 WHERE id < 100;
miscellaneous-functionsq2^TINYTEXTJTINYTEXT

A TEXT column with a maximum length of 255 (28 - 1) characters.
string-type-overviewH2_OPTIMIZE TABLE!Syntax:
OPTIMIZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name] ...

OPTIMIZE TABLE should be used if you have deleted a large part of a
table or if you have made many changes to a table with variable-length
rows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns).
Deleted rows are maintained in a linked list and subsequent INSERT
operations reuse old row positions. You can use OPTIMIZE TABLE to
reclaim the unused space and to defragment the data file.

This statement requires SELECT and INSERT privileges for the table.
optimize-table2`DECODE
Syntax:
DECODE(crypt_str,pass_str)

Decrypts the encrypted string crypt_str using pass_str as the password.
crypt_str should be a string returned from ENCODE().
encryption-functionsx"a<=>Syntax:
<=>

NULL-safe equal. This operator performs an equality comparison like the
= operator, but returns 1 rather than NULL if both operands are NULL,
and 0 rather than NULL if one operand is NULL.
mysql> SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;
        -> 1, 1, 0
mysql> SELECT 1 = 1, NULL = NULL, 1 = NULL;
        -> 1, NULL, NULL
comparison-operators62bLOAD DATA FROM MASTERSyntax:
LOAD DATA FROM MASTER

This statement takes a snapshot of the master and copies it to the
slave. It updates the values of MASTER_LOG_FILE and MASTER_LOG_POS so
that the slave starts replicating from the correct position. Any table
and database exclusion rules specified with the --replicate-*-do-* and
--replicate-*-ignore-* options are honored. --replicate-rewrite-db is
not taken into account because a user could use this option to set up a
non-unique mapping such as --replicate-rewrite-db="db1->db3" and
--replicate-rewrite-db="db2->db3", which would confuse the slave when
loading tables from the master.

Use of this statement is subject to the following conditions:

o It works only for MyISAM tables. Attempting to load a non-MyISAM
  table results in the following error:

ERROR 1189 (08S01): Net error reading from master

o It acquires a global read lock on the master while taking the
  snapshot, which prevents updates on the master during the load
  operation.

If you are loading large tables, you might have to increase the values
of net_read_timeout and net_write_timeout on both the master and slave
servers. See [server-system-variables].

Note that LOAD DATA FROM MASTER does not copy any tables from the mysql
database. This makes it easy to have different users and privileges on
the master and the slave.

To use LOAD DATA FROM MASTER, the replication account that is used to
connect to the master must have the RELOAD and SUPER privileges on the
master and the SELECT privilege for all master tables you want to load.
All master tables for which the user does not have the SELECT privilege
are ignored by LOAD DATA FROM MASTER. This is because the master hides
them from the user: LOAD DATA FROM MASTER calls SHOW DATABASES to know
the master databases to load, but SHOW DATABASES returns only databases
for which the user has some privilege. See [show-databases]. On the
slave side, the user that issues LOAD DATA FROM MASTER must have
privileges for dropping and creating the databases and tables that are
copied.
load-data-from-master2cRESETSyntax:
RESET reset_option [, reset_option] ...

The RESET statement is used to clear the state of various server
operations. You must have the RELOAD privilege to execute RESET.

RESET acts as a stronger version of the FLUSH statement. See [flush].
reset"dGET_LOCK
Syntax:
GET_LOCK(str,timeout)

Tries to obtain a lock with a name given by the string str, using a
timeout of timeout seconds. Returns 1 if the lock was obtained
successfully, 0 if the attempt timed out (for example, because another
client has previously locked the name), or NULL if an error occurred
(such as running out of memory or the thread was killed with mysqladmin
kill). If you have a lock obtained with GET_LOCK(), it is released when
you execute RELEASE_LOCK(), execute a new GET_LOCK(), or your
connection terminates (either normally or abnormally). Locks obtained
with GET_LOCK() do not interact with transactions. That is, committing
a transaction does not release any such locks obtained during the
transaction.

This function can be used to implement application locks or to simulate
record locks. Names are locked on a server-wide basis. If a name has
been locked by one client, GET_LOCK() blocks any request by another
client for a lock with the same name. This allows clients that agree on
a given lock name to use the name to perform cooperative advisory
locking. But be aware that it also allows a client that is not among
the set of cooperating clients to lock a name, either inadvertently or
deliberately, and thus prevent any of the cooperating clients from
locking that name. One way to reduce the likelihood of this is to use
lock names that are database-specific or application-specific. For
example, use lock names of the form db_name.str or app_name.str.
mysql> SELECT GET_LOCK('lock1',10);
        -> 1
mysql> SELECT IS_FREE_LOCK('lock2');
        -> 1
mysql> SELECT GET_LOCK('lock2',10);
        -> 1
mysql> SELECT RELEASE_LOCK('lock2');
        -> 1
mysql> SELECT RELEASE_LOCK('lock1');
        -> NULL
miscellaneous-functionsV2eUCASE!6Syntax:
UCASE(str)

UCASE() is a synonym for UPPER().
string-functions2fSHOW BINLOG EVENTSSyntax:
SHOW BINLOG EVENTS
   [IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]

Shows the events in the binary log. If you do not specify 'log_name',
the first binary log is displayed.
show-binlog-events2gMPOLYFROMWKBMPolyFromWKB(wkb[,srid]), MultiPolygonFromWKB(wkb[,srid])

Constructs a MULTIPOLYGON value using its WKB representation and SRID.
gis-wkb-functionsS"hITERATE#}Syntax:
ITERATE label

ITERATE can appear only within LOOP, REPEAT, and WHILE statements.
ITERATE means "do the loop again."
CREATE PROCEDURE doiterate(p1 INT)
BEGIN
  label1: LOOP
    SET p1 = p1 + 1;
    IF p1 < 10 THEN ITERATE label1; END IF;
    LEAVE label1;
  END LOOP label1;
  SET @x = p1;
END
iterate-statementQ2iDOBSyntax:
DO expr [, expr] ...

DO executes the expressions but does not return any results. In most
respects, DO is shorthand for SELECT expr, ..., but has the advantage
that it is slightly faster when you do not care about the result.

DO is useful primarily with functions that have side effects, such as
RELEASE_LOCK().
do*"jCURTIMESyntax:
CURTIME()

Returns the current time as a value in 'HH:MM:SS' or HHMMSS format,
depending on whether the function is used in a string or numeric
context.
^mysql> SELECT CURTIME();
        -> '23:50:26'
mysql> SELECT CURTIME() + 0;
        -> 235026
date-and-time-functions+2kCHAR_LENGTH!Syntax:
CHAR_LENGTH(str)

Returns the length of the string str, measured in characters. A
multi-byte character counts as a single character. This means that for
a string containing five two-byte characters, LENGTH() returns 10,
whereas CHAR_LENGTH() returns 5.
string-functions2lBIGINTBIGINT[(M)] [UNSIGNED] [ZEROFILL]

A large integer. The signed range is -9223372036854775808 to
9223372036854775807. The unsigned range is 0 to 18446744073709551615.
numeric-type-overview2mSETSyntax:
SET variable_assignment [, variable_assignment] ...

variable_assignment:
      user_var_name = expr
    | [GLOBAL | SESSION] system_var_name = expr
    | [@@global. | @@session. | @@]system_var_name = expr

The SET statement assigns values to different types of variables that
affect the operation of the server or your client. Older versions of
MySQL employed SET OPTION, but this syntax is deprecated in favor of
SET without OPTION.

set-option2nDATEDATE

A date. The supported range is '1000-01-01' to '9999-12-31'. MySQL
displays DATE values in 'YYYY-MM-DD' format, but allows you to assign
values to DATE columns using either strings or numbers.
date-and-time-type-overview"oCONV!Syntax:
CONV(N,from_base,to_base)

Converts numbers between different number bases. Returns a string
representation of the number N, converted from base from_base to base
to_base. Returns NULL if any argument is NULL. The argument N is
interpreted as an integer, but may be specified as an integer or a
string. The minimum base is 2 and the maximum base is 36. If to_base is
a negative number, N is regarded as a signed number. Otherwise, N is
treated as unsigned. CONV() works with 64-bit precision.
mysql> SELECT CONV('a',16,2);
        -> '1010'
mysql> SELECT CONV('6E',18,8);
        -> '172'
mysql> SELECT CONV(-17,10,-18);
        -> '-H'
mysql> SELECT CONV(10+'10'+'10'+0xa,10,10);
        -> '40'
string-functions2pSHOW OPEN TABLESSyntax:
SHOW OPEN TABLES [FROM db_name] [LIKE 'pattern']

SHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open
in the table cache. See [table-cache].
show-open-tables>"qEXTRACTSyntax:
EXTRACT(type FROM date)

The EXTRACT() function uses the same kinds of interval type specifiers
as DATE_ADD() or DATE_SUB(), but extracts parts from the date rather
than performing date arithmetic.
Emysql> SELECT EXTRACT(YEAR FROM '1999-07-02');
       -> 1999
mysql> SELECT EXTRACT(YEAR_MONTH FROM '1999-07-02 01:02:03');
       -> 199907
mysql> SELECT EXTRACT(DAY_MINUTE FROM '1999-07-02 01:02:03');
       -> 20102
mysql> SELECT EXTRACT(MICROSECOND
    ->                FROM '2003-01-02 10:30:00.00123');
        -> 123
date-and-time-functionsF"rENCRYPT
Syntax:
ENCRYPT(str[,salt])

Encrypts str using the Unix crypt() system call and returns a binary
string. The salt argument should be a string with at least two
characters. If no salt argument is given, a random value is used.
;mysql> SELECT ENCRYPT('hello');
        -> 'VxuFAJXVARROc'
encryption-functions?2sSHOW STATUSSyntax:
SHOW [GLOBAL | SESSION] STATUS [LIKE 'pattern']

SHOW STATUS provides server status information. This information also
can be obtained using the mysqladmin extended-status command.
With a LIKE clause, the statement displays only rows for those
variables with names that match the pattern:

mysql> SHOW STATUS LIKE 'Key%';
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| Key_blocks_used    | 14955    |
| Key_read_requests  | 96854827 |
| Key_reads          | 162040   |
| Key_write_requests | 7589728  |
| Key_writes         | 3813196  |
+--------------------+----------+

The GLOBAL and SESSION options are new in MySQL 5.0.2. With the GLOBAL
modifier, SHOW STATUS displays the status values for all connections to
MySQL. With SESSION, it displays the status values for the current
connection. If no modifier is present, the default is SESSION. LOCAL is
a synonym for SESSION.

Some status variables have only a global value. For these, you get the
same value for both GLOBAL and SESSION.
show-status2tOLD_PASSWORD
Syntax:
OLD_PASSWORD(str)

OLD_PASSWORD() was added to MySQL when the implementation of PASSWORD()
was changed to improve security. OLD_PASSWORD() returns the value of
the old (pre-4.1) implementation of PASSWORD() as a binary string, and
is intended to permit you to reset passwords for any pre-4.1 clients
that need to connect to your version 5.0 MySQL server without locking
them out. See [password-hashing].
encryption-functions2uSET VARIABLE#Syntax:
SET var_name = expr [, var_name = expr] ...

The SET statement in stored routines is an extended version of the
general SET statement. Referenced variables may be ones declared inside
a routine, or global system variables.

The SET statement in stored routines is implemented as part of the
pre-existing SET syntax. This allows an extended syntax of SET a=x,
b=y, ... where different variable types (locally declared variables and
global and session server variables) can be mixed. This also allows
combinations of local variables and some options that make sense only
for system variables; in that case, the options are recognized but
ignored.

set-statement"vFORMAT!Syntax:
FORMAT(X,D)

Formats the number X to a format like '#,###,###.##', rounded to D
decimal places, and returns the result as a string. If D is 0, the
result has no decimal point or fractional part.
mysql> SELECT FORMAT(12332.123456, 4);
        -> '12,332.1235'
mysql> SELECT FORMAT(12332.1,4);
        -> '12,332.1000'
mysql> SELECT FORMAT(12332.2,0);
        -> '12,332'
string-functions"w||Syntax:
OR, ||

Logical OR. When both operands are non-NULL, the result is 1 if any
operand is non-zero, and 0 otherwise. With a NULL operand, the result
is 1 if the other operand is non-zero, and NULL otherwise. If both
operands are NULL, the result is NULL.
mysql> SELECT 1 || 1;
        -> 1
mysql> SELECT 1 || 0;
        -> 1
mysql> SELECT 0 || 0;
        -> 0
mysql> SELECT 0 || NULL;
        -> NULL
mysql> SELECT 1 || NULL;
        -> 1
logical-operators"x
BIT_LENGTH!GSyntax:
BIT_LENGTH(str)

Returns the length of the string str in bits.
0mysql> SELECT BIT_LENGTH('text');
        -> 32
string-functions"yEXTERIORRINGYExteriorRing(poly)

Returns the exterior ring of the Polygon value poly as a LineString.
qmysql> SET @poly =
    -> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
mysql> SELECT AsText(ExteriorRing(GeomFromText(@poly)));
+-------------------------------------------+
| AsText(ExteriorRing(GeomFromText(@poly))) |
+-------------------------------------------+
| LINESTRING(0 0,0 3,3 3,3 0,0 0)           |
+-------------------------------------------+
polygon-property-functions2zGEOMFROMWKBGeomFromWKB(wkb[,srid]), GeometryFromWKB(wkb[,srid])

Constructs a geometry value of any type using its WKB representation
and SRID.
gis-wkb-functions2{SHOW SLAVE HOSTSSyntax:
SHOW SLAVE HOSTS

Displays a list of replication slaves currently registered with the
master. Any slave not started with the --report-host=slave_name option
is not visible in this list.
show-slave-hostsF"|START TRANSACTIONSyntax:
START TRANSACTION | BEGIN [WORK]
COMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
ROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
SET AUTOCOMMIT = {0 | 1}

The START TRANSACTION and BEGIN statement begin a new transaction.
COMMIT commits the current transaction, making its changes permanent.
ROLLBACK rolls back the current transaction, canceling its changes. The
SET AUTOCOMMIT statement disables or enables the default autocommit
mode for the current connection.

Beginning with MySQL 5.0.3, the optional WORK keyword is supported for
COMMIT and RELEASE, as are the CHAIN and RELEASE clauses. CHAIN and
RELEASE can be used for additional control over transaction completion.
The value of the completion_type system variable determines the default
completion behavior. See [server-system-variables].

The AND CHAIN clause causes a new transaction to begin as soon as the
current one ends, and the new transaction has the same isolation level
as the just-terminated transaction. The RELEASE clause causes the
server to disconnect the current client connection after terminating
the current transaction. Including the NO keyword suppresses CHAIN or
RELEASE completion, which can be useful if the completion_type system
variable is set to cause chaining or release completion by default.

By default, MySQL runs with autocommit mode enabled. This means that as
soon as you execute a statement that updates (modifies) a table, MySQL
stores the update on disk.

If you are using a transaction-safe storage engine (such as InnoDB,
BDB, or NDB Cluster), you can disable autocommit mode with the
following statement:

SET AUTOCOMMIT=0;

After disabling autocommit mode by setting the AUTOCOMMIT variable to
zero, you must use COMMIT to store your changes to disk or ROLLBACK if
you want to ignore the changes you have made since the beginning of
your transaction.

To disable autocommit mode for a single series of statements, use the
START TRANSACTION statement:
wSTART TRANSACTION;
SELECT @A:=SUM(salary) FROM table1 WHERE type=1;
UPDATE table2 SET summary=@A WHERE type=1;
COMMIT;
commit"}BETWEEN ANDSyntax:
expr BETWEEN min AND max

If expr is greater than or equal to min and expr is less than or equal
to max, BETWEEN returns 1, otherwise it returns 0. This is equivalent
to the expression (min <= expr AND expr <= max) if all the arguments
are of the same type. Otherwise type conversion takes place according
to the rules described in [type-conversion], but applied to all the
three arguments.
mysql> SELECT 1 BETWEEN 2 AND 3;
        -> 0
mysql> SELECT 'b' BETWEEN 'a' AND 'c';
        -> 1
mysql> SELECT 2 BETWEEN 2 AND '3';
        -> 1
mysql> SELECT 2 BETWEEN 2 AND 'x-3';
        -> 0
comparison-operators2~MULTIPOLYGONMultiPolygon(poly1,poly2,...)

Constructs a WKB MultiPolygon value from a set of WKB Polygon
arguments. If any argument is not a WKB Polygon, the return value is
NULL.
gis-mysql-specific-functions\"TIME_FORMATSyntax:
TIME_FORMAT(time,format)

This is used like the DATE_FORMAT() function, but the format string may
contain format specifiers only for hours, minutes, and seconds. Other
specifiers produce a NULL value or 0.
Wmysql> SELECT TIME_FORMAT('100:00:00', '%H %k %h %I %l');
        -> '100 100 04 04 4'
date-and-time-functions"LEFT!PSyntax:
LEFT(str,len)

Returns the leftmost len characters from the string str.
7mysql> SELECT LEFT('foobarbar', 5);
        -> 'fooba'
string-functionsZ2FLUSH QUERY CACHEYou can defragment the query cache to better utilize its memory with
the FLUSH QUERY CACHE statement. The statement does not remove any
queries from the cache.

The RESET QUERY CACHE statement removes all query results from the
query cache. The FLUSH TABLES statement also does this.
"query-cache-status-and-maintenance12
SET DATA TYPESET('value1','value2',...)

A set. A string object that can have zero or more values, each of which
must be chosen from the list of values 'value1', 'value2', ... A SET
column can have a maximum of 64 members. SET values are represented
internally as integers.
string-type-overviewE"RANDSyntax:
RAND(), RAND(N)

Returns a random floating-point value v between 0 and 1 inclusive (that
is, in the range 0 <= v <= 1.0). If an integer argument N is specified,
it is used as the seed value, which produces a repeatable sequence.
1mysql> SELECT RAND();
        -> 0.9233482386203
mysql> SELECT RAND(20);
        -> 0.15888261251047
mysql> SELECT RAND(20);
        -> 0.15888261251047
mysql> SELECT RAND();
        -> 0.63553050033332
mysql> SELECT RAND();
        -> 0.70100469486881
mysql> SELECT RAND(20);
        -> 0.15888261251047
mathematical-functionsH"RPAD!Syntax:
RPAD(str,len,padstr)

Returns the string str, right-padded with the string padstr to a length
of len characters. If str is longer than len, the return value is
shortened to len characters.
bmysql> SELECT RPAD('hi',5,'?');
        -> 'hi???'
mysql> SELECT RPAD('hi',1,'?');
        -> 'h'
string-functions2CREATE DATABASE$Syntax:
CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
    [create_specification [, create_specification] ...]

create_specification:
    [DEFAULT] CHARACTER SET charset_name
  | [DEFAULT] COLLATE collation_name

CREATE DATABASE creates a database with the given name. To use this
statement, you need the CREATE privilege for the database. CREATE
SCHEMA is a synonym for CREATE DATABASE as of MySQL 5.0.2.
create-database	2DECDEC[(M[,D])] [UNSIGNED] [ZEROFILL], NUMERIC[(M[,D])] [UNSIGNED]
[ZEROFILL], FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]

These types are synonyms for DECIMAL. The FIXED synonym is available
for compatibility with other database systems.
numeric-type-overview2VAR_POPiSyntax:
VAR_POP(expr)

Returns the population standard variance of expr. It considers rows as
the whole population, not as a sample, so it has the number of rows as
the denominator. This function was added in MySQL 5.0.3. Before 5.0.3,
you can use VARIANCE(), which is equivalent but is not standard SQL.

VAR_POP() returns NULL if there were no matching rows.
group-by-functionsg"ELT!Syntax:
ELT(N,str1,str2,str3,...)

Returns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is
less than 1 or greater than the number of arguments. ELT() is the
complement of FIELD().
mysql> SELECT ELT(1, 'ej', 'Heja', 'hej', 'foo');
        -> 'ej'
mysql> SELECT ELT(4, 'ej', 'Heja', 'hej', 'foo');
        -> 'foo'
string-functions&2
ALTER VIEW$Syntax:
ALTER
    [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
    [DEFINER = { user | CURRENT_USER }]
    [SQL SECURITY { DEFINER | INVOKER }]
    VIEW view_name [(column_list)]
    AS select_statement
    [WITH [CASCADED | LOCAL] CHECK OPTION]

This statement changes the definition of an existing view. The syntax
is similar to that for CREATE VIEW. See [create-view]. This statement
requires the CREATE VIEW and DROP privileges for the view, and some
privilege for each column referred to in the SELECT statement.

alter-view#2SHOW DATABASESSyntax:
SHOW {DATABASES | SCHEMAS} [LIKE 'pattern']

SHOW DATABASES lists the databases on the MySQL server host. SHOW
SCHEMAS is a synonym for SHOW DATABASES as of MySQL 5.0.2.

You see only those databases for which you have some kind of privilege,
unless you have the global SHOW DATABASES privilege. You can also get
this list using the mysqlshow command.

If the server was started with the --skip-show-database option, you
cannot use this statement at all unless you have the SHOW DATABASES
privilege.
show-databasesZ"~Syntax:
~

Invert all bits.
#mysql> SELECT 5 & ~1;
        -> 4

bit-functions2TEXTTEXT[(M)]

A TEXT column with a maximum length of 65,535 (216 - 1) characters.

An optional length M can be given for this type. If this is done, MySQL
creates the column as the smallest TEXT type large enough to hold
values M characters long.
string-type-overviewi"	CONCAT_WS!rSyntax:
CONCAT_WS(separator,str1,str2,...)

CONCAT_WS() stands for Concatenate With Separator and is a special form
of CONCAT(). The first argument is the separator for the rest of the
arguments. The separator is added between the strings to be
concatenated. The separator can be a string, as can the rest of the
arguments. If the separator is NULL, the result is NULL.
mysql> SELECT CONCAT_WS(',','First name','Second name','Last Name');
        -> 'First name,Second name,Last Name'
mysql> SELECT CONCAT_WS(',','First name',NULL,'Last Name');
        -> 'First name,Last Name'
string-functions"	ROW_COUNTSyntax:
ROW_COUNT()

ROW_COUNT() returns the number of rows updated, inserted, or deleted by
the preceding statement. This is the same as the row count that the
mysql client displays and the value from the mysql_affected_rows() C
API function.
mysql> INSERT INTO t VALUES(1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
|           3 |
+-------------+
1 row in set (0.00 sec)

mysql> DELETE FROM t WHERE i IN(1,2);
Query OK, 2 rows affected (0.00 sec)

mysql> SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
|           2 |
+-------------+
1 row in set (0.00 sec)
information-functions"ASINSyntax:
ASIN(X)

Returns the arc sine of X, that is, the value whose sine is X. Returns
NULL if X is not in the range -1 to 1.
mysql> SELECT ASIN(0.2);
        -> 0.20135792079033
mysql> SELECT ASIN('foo');

+-------------+
| ASIN('foo') |
+-------------+
|           0 |
+-------------+
1 row in set, 1 warning (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+-----------------------------------------+
| Level   | Code | Message                                 |
+---------+------+-----------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'foo' |
+---------+------+-----------------------------------------+
mathematical-functions2	SHOW LOGSqSyntax:
SHOW [BDB] LOGS

In MySQL 5.0, this is a deprecated synonym for SHOW ENGINE BDB LOGS.
See [show-engine].
	show-logs"SIGNySyntax:
SIGN(X)

Returns the sign of the argument as -1, 0, or 1, depending on whether X
is negative, zero, or positive.
qmysql> SELECT SIGN(-32);
        -> -1
mysql> SELECT SIGN(0);
        -> 0
mysql> SELECT SIGN(234);
        -> 1
mathematical-functionsv"SEC_TO_TIMESyntax:
SEC_TO_TIME(seconds)

Returns the seconds argument, converted to hours, minutes, and seconds,
as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the
function is used in a string or numeric context.
lmysql> SELECT SEC_TO_TIME(2378);
        -> '00:39:38'
mysql> SELECT SEC_TO_TIME(2378) + 0;
        -> 3938
date-and-time-functionsJ2FLOAT%FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]

A small (single-precision) floating-point number. Allowable values are
-3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to
3.402823466E+38. These are the theoretical limits, based on the IEEE
standard. The actual range might be slightly smaller depending on your
hardware or operating system.

M is the total number of decimal digits and D is the number of digits
following the decimal point. If M and D are omitted, values are stored
to the limits allowed by the hardware. A single-precision
floating-point number is accurate to approximately 7 decimal places.

UNSIGNED, if specified, disallows negative values.

Using FLOAT might give you some unexpected problems because all
calculations in MySQL are done with double precision. See
[no-matching-rows].
numeric-type-overview"LOCATE!4Syntax:
LOCATE(substr,str), LOCATE(substr,str,pos)

The first syntax returns the position of the first occurrence of
substring substr in string str. The second syntax returns the position
of the first occurrence of substring substr in string str, starting at
position pos. Returns 0 if substr is not in str.
mysql> SELECT LOCATE('bar', 'foobarbar');
        -> 4
mysql> SELECT LOCATE('xbar', 'foobar');
        -> 0
mysql> SELECT LOCATE('bar', 'foobarbar', 5);
        -> 7
string-functions"CHARSETHSyntax:
CHARSET(str)

Returns the character set of the string argument.
mysql> SELECT CHARSET('abc');
        -> 'latin1'
mysql> SELECT CHARSET(CONVERT('abc' USING utf8));
        -> 'utf8'
mysql> SELECT CHARSET(USER());
        -> 'utf8'
information-functions2SUBDATESyntax:
SUBDATE(date,INTERVAL expr type), SUBDATE(expr,days)

When invoked with the INTERVAL form of the second argument, SUBDATE()
is a synonym for DATE_SUB(). For information on the INTERVAL argument,
see the discussion for DATE_ADD().

mysql> SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY);
        -> '1997-12-02'
mysql> SELECT SUBDATE('1998-01-02', INTERVAL 31 DAY);
        -> '1997-12-02'

The second form allows the use of an integer value for days. In such
cases, it is interpreted as the number of days to be subtracted from
the date or datetime expression expr.

mysql> SELECT SUBDATE('1998-01-02 12:00:00', 31);
        -> '1997-12-02 12:00:00'

Note: You cannot use format "%X%V" to convert a year-week string to a
date because the combination of a year and week does not uniquely
identify a year and month if the week crosses a month boundary. To
convert a year-week to a date, then you should also specify the
weekday:

mysql> SELECT STR_TO_DATE('200442 Monday', '%X%V %W');
        -> '2004-10-18'
date-and-time-functions"	DAYOFYEARVSyntax:
DAYOFYEAR(date)

Returns the day of the year for date, in the range 1 to 366.
5mysql> SELECT DAYOFYEAR('1998-02-03');
        -> 34
date-and-time-functions"%]Syntax:
MOD(N,M), N % M, N MOD M

Modulo operation. Returns the remainder of N divided by M.
mysql> SELECT MOD(234, 10);
        -> 4
mysql> SELECT 253 % 7;
        -> 1
mysql> SELECT MOD(29,9);
        -> 2
mysql> SELECT 29 MOD 9;
        -> 2
mathematical-functions"2LONGTEXTLONGTEXT

A TEXT column with a maximum length of 4,294,967,295 or 4GB (232 - 1)
characters. The maximum effective (permitted) length of LONGTEXT
columns depends on the configured maximum packet size in the
client/server protocol and available memory.
string-type-overview2DISJOINTkDisjoint(g1,g2)

Returns 1 or 0 to indicate whether g1 is spatially disjoint from (does
not intersect) g2.
<functions-that-test-spatial-relationships-between-geometries82KILL%Syntax:
KILL [CONNECTION | QUERY] thread_id

Each connection to mysqld runs in a separate thread. You can see which
threads are running with the SHOW PROCESSLIST statement and kill a
thread with the KILL thread_id statement.

In MySQL 5.0.0, KILL allows the optional CONNECTION or QUERY modifier:

o KILL CONNECTION is the same as KILL with no modifier: It terminates
  the connection associated with the given thread_id.

o KILL QUERY terminates the statement that the connection is currently
  executing, but leaves the connection itself intact.

If you have the PROCESS privilege, you can see all threads. If you have
the SUPER privilege, you can kill all threads and statements.
Otherwise, you can see and kill only your own threads and statements.

You can also use the mysqladmin processlist and mysqladmin kill
commands to examine and kill threads.

Note: You cannot use KILL with the Embedded MySQL Server library,
because the embedded server merely runs inside the threads of the host
application. It does not create any connection threads of its own.
kill"ASTEXTqAsText(g)

Converts a value in internal geometry format to its WKT representation
and returns the string result.
mysql> SET @g = 'LineString(1 1,2 2,3 3)';
mysql> SELECT AsText(GeomFromText(@g));
+--------------------------+
| AsText(GeomFromText(@g)) |
+--------------------------+
| LINESTRING(1 1,2 2,3 3)  |
+--------------------------+
/functions-to-convert-geometries-between-formatsI"LPAD!Syntax:
LPAD(str,len,padstr)

Returns the string str, left-padded with the string padstr to a length
of len characters. If str is longer than len, the return value is
shortened to len characters.

cmysql> SELECT LPAD('hi',4,'??');
        -> '??hi'
mysql> SELECT LPAD('hi',1,'??');
        -> 'h'
string-functions2
RESTORE TABLESyntax:
RESTORE TABLE tbl_name [, tbl_name] ... FROM '/path/to/backup/directory'

RESTORE TABLE restores the table or tables from a backup that was made
with BACKUP TABLE. Existing tables are not overwritten; if you try to
restore over an existing table, an error occurs. Just as for BACKUP
TABLE, RESTORE TABLE currently works only for MyISAM tables. The
directory should be specified as a full pathname.

The backup for each table consists of its .frm format file and .MYD
data file. The restore operation restores those files, and then uses
them to rebuild the .MYI index file. Restoring takes longer than
backing up due to the need to rebuild the indexes. The more indexes the
table has, the longer it takes.

restore-table2DECLARE CONDITION#Syntax:
DECLARE condition_name CONDITION FOR condition_value

condition_value:
    SQLSTATE [VALUE] sqlstate_value
  | mysql_error_code

This statement specifies conditions that need specific handling. It
associates a name with a specified error condition. The name can
subsequently be used in a DECLARE HANDLER statement. See
[declare-handlers].

A condition_value can be an SQLSTATE value or a MySQL error code.
declare-conditionsQ2OVERLAPSOverlaps(g1,g2)

Returns 1 or 0 to indicate whether g1 spatially overlaps g2. The term
spatially overlaps is used if two geometries intersect and their
intersection results in a geometry of the same dimension but not equal
to either of the given geometries.
<functions-that-test-spatial-relationships-between-geometries"
NUMGEOMETRIESXNumGeometries(gc)

Returns the number of geometries in the GeometryCollection value gc.
1mysql> SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';
mysql> SELECT NumGeometries(GeomFromText(@gc));
+----------------------------------+
| NumGeometries(GeomFromText(@gc)) |
+----------------------------------+
|                                2 |
+----------------------------------+
%geometrycollection-property-functionse2!SET GLOBAL SQL_SLAVE_SKIP_COUNTERSyntax:
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = N

This statement skips the next N events from the master. This is useful
for recovering from replication stops caused by a statement.

This statement is valid only when the slave thread is not running.
Otherwise, it produces an error.
!set-global-sql-slave-skip-counter"	MONTHNAMEFSyntax:
MONTHNAME(date)

Returns the full name of the month for date.
=mysql> SELECT MONTHNAME('1998-02-05');
        -> 'February'
date-and-time-functions2MBREQUALMBREqual(g1,g2)

Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of
the two geometries g1 and g2 are the same.
relations-on-geometry-mbr62CHANGE MASTER TOSyntax:
CHANGE MASTER TO master_def [, master_def] ...

master_def:
    MASTER_HOST = 'host_name'
  | MASTER_USER = 'user_name'
  | MASTER_PASSWORD = 'password'
  | MASTER_PORT = port_num
  | MASTER_CONNECT_RETRY = count
  | MASTER_LOG_FILE = 'master_log_name'
  | MASTER_LOG_POS = master_log_pos
  | RELAY_LOG_FILE = 'relay_log_name'
  | RELAY_LOG_POS = relay_log_pos
  | MASTER_SSL = {0|1}
  | MASTER_SSL_CA = 'ca_file_name'
  | MASTER_SSL_CAPATH = 'ca_directory_name'
  | MASTER_SSL_CERT = 'cert_file_name'
  | MASTER_SSL_KEY = 'key_file_name'
  | MASTER_SSL_CIPHER = 'cipher_list'

CHANGE MASTER TO changes the parameters that the slave server uses for
connecting to and communicating with the master server. It also updates
the contents of the master.info and relay-log.info files.

MASTER_USER, MASTER_PASSWORD, MASTER_SSL, MASTER_SSL_CA,
MASTER_SSL_CAPATH, MASTER_SSL_CERT, MASTER_SSL_KEY, and
MASTER_SSL_CIPHER provide information to the slave about how to connect
to its master.

The SSL options (MASTER_SSL, MASTER_SSL_CA, MASTER_SSL_CAPATH,
MASTER_SSL_CERT, MASTER_SSL_KEY, and MASTER_SSL_CIPHER) can be changed
even on slaves that are compiled without SSL support. They are saved to
the master.info file, but are ignored unless you use a server that has
SSL support enabled.

If you don't specify a given parameter, it keeps its old value, except
as indicated in the following discussion. For example, if the password
to connect to your MySQL master has changed, you just need to issue
these statements to tell the slave about the new password:

STOP SLAVE; -- if replication was running
CHANGE MASTER TO MASTER_PASSWORD='new3cret';
START SLAVE; -- if you want to restart replication

There is no need to specify the parameters that do not change (host,
port, user, and so forth).

MASTER_HOST and MASTER_PORT are the hostname (or IP address) of the
master host and its TCP/IP port. Note that if MASTER_HOST is equal to
localhost, then, like in other parts of MySQL, the port number might be
ignored (if Unix socket files can be used, for example).

If you specify MASTER_HOST or MASTER_PORT, the slave assumes that the
master server is different from before (even if you specify a host or
port value that is the same as the current value.) In this case, the
old values for the master binary log name and position are considered
no longer applicable, so if you do not specify MASTER_LOG_FILE and
MASTER_LOG_POS in the statement, MASTER_LOG_FILE='' and
MASTER_LOG_POS=4 are silently appended to it.

MASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the
slave I/O thread should begin reading from the master the next time the
thread starts. If you specify either of them, you cannot specify
RELAY_LOG_FILE or RELAY_LOG_POS. If neither of MASTER_LOG_FILE or
MASTER_LOG_POS are specified, the slave uses the last coordinates of
the slave SQL thread before CHANGE MASTER was issued. This ensures that
there is no discontinuity in replication, even if the slave SQL thread
was late compared to the slave I/O thread, when you merely want to
change, say, the password to use.

CHANGE MASTER deletes all relay log files and starts a new one, unless
you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay logs
are kept; the relay_log_purge global variable is set silently to 0.

CHANGE MASTER is useful for setting up a slave when you have the
snapshot of the master and have recorded the log and the offset
corresponding to it. After loading the snapshot into the slave, you can
run CHANGE MASTER TO MASTER_LOG_FILE='log_name_on_master',
MASTER_LOG_POS=log_offset_on_master on the slave.

The following example changes the master and master's binary log
coordinates. This is used when you want to set up the slave to
replicate the master:

CHANGE MASTER TO
  MASTER_HOST='master2.mycompany.com',
  MASTER_USER='replication',
  MASTER_PASSWORD='bigs3cret',
  MASTER_PORT=3306,
  MASTER_LOG_FILE='master2-bin.001',
  MASTER_LOG_POS=4,
  MASTER_CONNECT_RETRY=10;

The next example shows an operation that is less frequently employed.
It is used when the slave has relay logs that you want it to execute
again for some reason. To do this, the master need not be reachable.
You need only use CHANGE MASTER TO and start the SQL thread (START
SLAVE SQL_THREAD):

CHANGE MASTER TO
  RELAY_LOG_FILE='slave-relay-bin.006',
  RELAY_LOG_POS=4025;
change-master-to2
DROP DATABASE${Syntax:
DROP {DATABASE | SCHEMA} [IF EXISTS] db_name

DROP DATABASE drops all tables in the database and deletes the
database. Be very careful with this statement! To use DROP DATABASE,
you need the DROP privilege on the database. DROP SCHEMA is a synonym
for DROP DATABASE as of MySQL 5.0.2.

IF EXISTS is used to prevent an error from occurring if the database
does not exist.

drop-database"TIMESTAMP FUNCTION"Syntax:
TIMESTAMP(expr), TIMESTAMP(expr,expr2)

With a single argument, this function returns the date or datetime
expression expr as a datetime value. With two arguments, it adds the
time expression expr2 to the date or datetime expression expr and
returns the result as a datetime value.
mysql> SELECT TIMESTAMP('2003-12-31');
        -> '2003-12-31 00:00:00'
mysql> SELECT TIMESTAMP('2003-12-31 12:00:00','12:00:00');
        -> '2004-01-01 00:00:00'
date-and-time-functions}2CHARACTER_LENGTH!RSyntax:
CHARACTER_LENGTH(str)

CHARACTER_LENGTH() is a synonym for CHAR_LENGTH().
string-functions%2SHOW GRANTSSyntax:
SHOW GRANTS FOR user

This statement lists the GRANT statement or statements that must be
issued to duplicate the privileges that are granted to a MySQL user
account. The account is named using the same format as for the GRANT
statement; for example, 'jeffrey'@'localhost'. The user and host parts
of the account name correspond to the User and Host column values of
the user table row for the account.

mysql> SHOW GRANTS FOR 'root'@'localhost';
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+

To list the privileges granted to the account that you are using to
connect to the server, you can use any of the following statements:

SHOW GRANTS;
SHOW GRANTS FOR CURRENT_USER;
SHOW GRANTS FOR CURRENT_USER();
show-grants2SHOW PRIVILEGESSyntax:
SHOW PRIVILEGES

SHOW PRIVILEGES shows the list of system privileges that the MySQL
server supports. The exact list of privileges depends on the version of
your server.
show-privileges"INSERT FUNCTION!~Syntax:
INSERT(str,pos,len,newstr)

Returns the string str, with the substring beginning at position pos
and len characters long replaced by the string newstr. Returns the
original string if pos is not within the length of the string. Replaces
the rest of the string from position pos is len is not within the
length of the rest of the string. Returns NULL if any argument is NULL.
mysql> SELECT INSERT('Quadratic', 3, 4, 'What');
        -> 'QuWhattic'
mysql> SELECT INSERT('Quadratic', -1, 4, 'What');
        -> 'Quadratic'
mysql> SELECT INSERT('Quadratic', 3, 100, 'What');
        -> 'QuWhat'
string-functionsy"CRC32Syntax:
CRC32(expr)

Computes a cyclic redundancy check value and returns a 32-bit unsigned
value. The result is NULL if the argument is NULL. The argument is
expected to be a string and (if possible) is treated as one if it is
not.
hmysql> SELECT CRC32('MySQL');
        -> 3259397556
mysql> SELECT CRC32('mysql');
        -> 2501908538
mathematical-functionsh"XORSyntax:
XOR

Logical XOR. Returns NULL if either operand is NULL. For non-NULL
operands, evaluates to 1 if an odd number of operands is non-zero,
otherwise 0 is returned.
mysql> SELECT 1 XOR 1;
        -> 0
mysql> SELECT 1 XOR 0;
        -> 1
mysql> SELECT 1 XOR NULL;
        -> NULL
mysql> SELECT 1 XOR 1 XOR 1;
        -> 1
logical-operators"
STARTPOINTVStartPoint(ls)

Returns the Point that is the start point of the LineString value ls.
3mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
mysql> SELECT AsText(StartPoint(GeomFromText(@ls)));
+---------------------------------------+
| AsText(StartPoint(GeomFromText(@ls))) |
+---------------------------------------+
| POINT(1 1)                            |
+---------------------------------------+
linestring-property-functions2DECLARE VARIABLE#Syntax:
DECLARE var_name[,...] type [DEFAULT value]

This statement is used to declare local variables. To provide a default
value for the variable, include a DEFAULT clause. The value can be
specified as an expression; it need not be a constant. If the DEFAULT
clause is missing, the initial value is NULL.

Local variables are treated like routine parameters with respect to
data type and overflow checking. See [create-procedure].

The scope of a local variable is within the BEGIN ... END block where
it is declared. The variable can be referred to in blocks nested within
the declaring block, except those blocks that declare a variable with
the same name.
declare-local-variables2
MPOLYFROMTEXTMPolyFromText(wkt[,srid]), MultiPolygonFromText(wkt[,srid])

Constructs a MULTIPOLYGON value using its WKT representation and SRID.
gis-wkt-functions
2GRANT
Syntax:
GRANT priv_type [(column_list)] [, priv_type [(column_list)]] ...
    ON [object_type] {tbl_name | * | *.* | db_name.*}
    TO user [IDENTIFIED BY [PASSWORD] 'password']
        [, user [IDENTIFIED BY [PASSWORD] 'password']] ...
    [REQUIRE
        NONE |
        [{SSL| X509}]
        [CIPHER 'cipher' [AND]]
        [ISSUER 'issuer' [AND]]
        [SUBJECT 'subject']]
    [WITH with_option [with_option] ...]

object_type =
    TABLE
  | FUNCTION
  | PROCEDURE

with_option =
    GRANT OPTION
  | MAX_QUERIES_PER_HOUR count
  | MAX_UPDATES_PER_HOUR count
  | MAX_CONNECTIONS_PER_HOUR count
  | MAX_USER_CONNECTIONS count

The GRANT statement enables system administrators to create MySQL user
accounts and to grant rights to from accounts. To use GRANT, you must
have the GRANT OPTION privilege, and you must have the privileges that
you are granting. The REVOKE statement is related and enables
administrators to remove account privileges. See [revoke].

MySQL account information is stored in the tables of the mysql
database. This database and the access control system are discussed
extensively in [database-administration], which you should consult for
additional details.

Important: Some releases of MySQL introduce changes to the structure of
the grant tables to add new privileges or features. Whenever you update
to a new version of MySQL, you should update your grant tables to make
sure that they have the current structure so that you can take
advantage of any new capabilities. See [mysql-upgrade].

If the grant tables hold privilege rows that contain mixed-case
database or table names and the lower_case_table_names system variable
is set to a non-zero value, REVOKE cannot be used to revoke these
privileges. It will be necessary to manipulate the grant tables
directly. (GRANT will not create such rows when lower_case_table_names
is set, but such rows might have been created prior to setting the
variable.)

Privileges can be granted at several levels:

o Global level

  Global privileges apply to all databases on a given server. These
  privileges are stored in the mysql.user table. GRANT ALL ON *.* and
  REVOKE ALL ON *.* grant and revoke only global privileges.

o Database level

  Database privileges apply to all objects in a given database. These
  privileges are stored in the mysql.db and mysql.host tables. GRANT
  ALL ON db_name.* and REVOKE ALL ON db_name.* grant and revoke only
  database privileges.

o Table level

  Table privileges apply to all columns in a given table. These
  privileges are stored in the mysql.tables_priv table. GRANT ALL ON
  db_name.tbl_name and REVOKE ALL ON db_name.tbl_name grant and revoke
  only table privileges.

o Column level

  Column privileges apply to single columns in a given table. These
  privileges are stored in the mysql.columns_priv table. When using
  REVOKE, you must specify the same columns that were granted.

o Routine level

  The CREATE ROUTINE, ALTER ROUTINE, EXECUTE, and GRANT privileges
  apply to stored routines (functions and procedures). They can be
  granted at the global and database levels. Also, except for CREATE
  ROUTINE, these privileges can be granted at the routine level for
  individual routines and are stored in the mysql.procs_priv table.

The object_type clause was added in MySQL 5.0.6. It should be specified
as TABLE, FUNCTION, or PROCEDURE when the following object is a table,
a stored function, or a stored procedure.
grant2
MBRINTERSECTSMBRIntersects(g1,g2)

Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of
the two geometries g1 and g2 intersect.
relations-on-geometry-mbr2BIT_ORSyntax:
BIT_OR(expr)

Returns the bitwise OR of all bits in expr. The calculation is
performed with 64-bit (BIGINT) precision.
group-by-functionsp"YEARWEEKSyntax:
YEARWEEK(date), YEARWEEK(date,start)

Returns year and week for a date. The start argument works exactly like
the start argument to WEEK(). The year in the result may be different
from the year in the date argument for the first and the last week of
the year.
8mysql> SELECT YEARWEEK('1987-01-01');
        -> 198653
date-and-time-functions2NOT BETWEENZSyntax:
expr NOT BETWEEN min AND max

This is the same as NOT (expr BETWEEN min AND max).
comparison-operators"LOG106Syntax:
LOG10(X)

Returns the base-10 logarithm of X.
mysql> SELECT LOG10(2);
        -> 0.30102999566398
mysql> SELECT LOG10(100);
        -> 2
mysql> SELECT LOG10(-100);
        -> NULL
mathematical-functions"SQRTESyntax:
SQRT(X)

Returns the square root of a non-negative number X.
mysql> SELECT SQRT(4);
        -> 2
mysql> SELECT SQRT(20);
        -> 4.4721359549996
mysql> SELECT SQRT(-16);
        -> NULL        
mathematical-functions2DECIMALDECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]

For MySQL 5.0.3 and above:

A packed "exact" fixed-point number. M is the total number of decimal
digits (the precision) and D is the number of digits after the decimal
point (the scale). The decimal point and (for negative numbers) the `-'
sign are not counted in M. If D is 0, values have no decimal point or
fractional part. The maximum number of digits (M) for DECIMAL is 65 (64
from 5.0.3 to 5.0.5). The maximum number of supported decimals (D) is
30. If D is omitted, the default is 0. If M is omitted, the default is
10.

UNSIGNED, if specified, disallows negative values.

All basic calculations (+, -, *, /) with DECIMAL columns are done with
a precision of 65 digits.

Before MySQL 5.0.3:

An unpacked fixed-point number. Behaves like a CHAR column; "unpacked"
means the number is stored as a string, using one character for each
digit of the value. M is the total number of digits and D is the number
of digits after the decimal point. The decimal point and (for negative
numbers) the `-' sign are not counted in M, although space for them is
reserved. If D is 0, values have no decimal point or fractional part.
The maximum range of DECIMAL values is the same as for DOUBLE, but the
actual range for a given DECIMAL column may be constrained by the
choice of M and D. If D is omitted, the default is 0. If M is omitted,
the default is 10.

UNSIGNED, if specified, disallows negative values.
numeric-type-overview2CREATE FUNCTION"qSyntax:
CREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL|DECIMAL}
    SONAME shared_library_name

A user-defined function (UDF) is a way to extend MySQL with a new
function that works like a native (built-in) MySQL function such as
ABS() or CONCAT().

function_name is the name that should be used in SQL statements to
invoke the function. The RETURNS clause indicates the type of the
function's return value. As of MySQL 5.0.3, DECIMAL is a legal value
after RETURNS, but currently DECIMAL functions return string values and
should be written like STRING functions.

shared_library_name is the basename of the shared object file that
contains the code that implements the function. The file must be
located in a directory that is searched by your system's dynamic
linker.

To create a function, you must have the INSERT and privilege for the
mysql database. This is necessary because CREATE FUNCTION adds a row to
the mysql.func system table that records the function's name, type, and
shared library name. If you do not have this table, you should run the
mysql_upgrade command to create it. See [mysql-upgrade].
create-function	"	GEOMETRYNyGeometryN(gc,N)

Returns the N-th geometry in the GeometryCollection value gc.
Geometries are numbered beginning with 1.
Umysql> SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';
mysql> SELECT AsText(GeometryN(GeomFromText(@gc),1));
+----------------------------------------+
| AsText(GeometryN(GeomFromText(@gc),1)) |
+----------------------------------------+
| POINT(1 1)                             |
+----------------------------------------+
%geometrycollection-property-functionsa2CREATE INDEX$>Syntax:
CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name
    [USING type_name]
    ON tbl_name (index_col_name,...)

index_col_name:
    col_name [(length)] [ASC | DESC]

CREATE INDEX is mapped to an ALTER TABLE statement to create indexes.
See [alter-table]. For more information about indexes, see
[mysql-indexes].
create-index)2ALTER DATABASE$Syntax:
ALTER {DATABASE | SCHEMA} [db_name]
    alter_specification [, alter_specification] ...

alter_specification:
    [DEFAULT] CHARACTER SET charset_name
  | [DEFAULT] COLLATE collation_name

ALTER DATABASE enables you to change the overall characteristics of a
database. These characteristics are stored in the db.opt file in the
database directory. To use ALTER DATABASE, you need the ALTER privilege
on the database. ALTER SCHEMA is a synonym for ALTER DATABASE as of
MySQL 5.0.2.

The CHARACTER SET clause changes the default database character set.
The COLLATE clause changes the default database collation. [charset],
discusses character set and collation names.

The database name can be omitted, in which case the statement applies
to the default database.
alter-databasez"<<;Syntax:
<<

Shifts a longlong (BIGINT) number to the left.
#mysql> SELECT 1 << 2;
        -> 4

bit-functions2SHOW TABLE STATUSSyntax:
SHOW TABLE STATUS [FROM db_name] [LIKE 'pattern']

SHOW TABLE STATUS works likes SHOW TABLE, but provides a lot of
information about each table. You can also get this list using the
mysqlshow --status db_name command.
show-table-statusL"MD5
Syntax:
MD5(str)

Calculates an MD5 128-bit checksum for the string. The value is
returned as a binary string of 32 hex digits, or NULL if the argument
was NULL. The return value can, for example, be used as a hash key.
Lmysql> SELECT MD5('testing');
        -> 'ae2b1fca515949e5d54fb22b8ed95575'
encryption-functionsZ"<Syntax:
<

Less than:
"mysql> SELECT 2 < 2;
        -> 0
comparison-operators"UNIX_TIMESTAMPFSyntax:
UNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)

If called with no argument, returns a Unix timestamp (seconds since
'1970-01-01 00:00:00' UTC) as an unsigned integer. If UNIX_TIMESTAMP()
is called with a date argument, it returns the value of the argument as
seconds since '1970-01-01 00:00:00' UTC. date may be a DATE string, a
DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or
YYYYMMDD. The server interprets date as a value in the current time
zone and converts it to an internal value in UTC. Clients can set their
time zone as described in [time-zone-support].
mysql> SELECT UNIX_TIMESTAMP();
        -> 882226357
mysql> SELECT UNIX_TIMESTAMP('1997-10-04 22:23:00');
        -> 875996580
date-and-time-functions"
DAYOFMONTHWSyntax:
DAYOFMONTH(date)

Returns the day of the month for date, in the range 0 to 31.
5mysql> SELECT DAYOFMONTH('1998-02-03');
        -> 3
date-and-time-functionsx"ASCII!Syntax:
ASCII(str)

Returns the numeric value of the leftmost character of the string str.
Returns 0 if str is the empty string. Returns NULL if str is NULL.
ASCII() works for characters with numeric values from 0 to 255.
xmysql> SELECT ASCII('2');
        -> 50
mysql> SELECT ASCII(2);
        -> 50
mysql> SELECT ASCII('dx');
        -> 100
string-functions"DIVSSyntax:
DIV

Integer division. Similar to FLOOR(), but is safe with BIGINT values.
$mysql> SELECT 5 DIV 2;
        -> 2
arithmetic-functionsK2RENAME USER*Syntax:
RENAME USER old_user TO new_user
    [, old_user TO new_user] ...

The RENAME USER statement renames existing MySQL accounts. To use it,
you must have the global CREATE USER privilege or the UPDATE privilege
for the mysql database. An error occurs if any old account does not
exist or any new account exists. Each account is named using the same
format as for the GRANT statement; for example, 'jeffrey'@'localhost'.
The user and host parts of the account name correspond to the User and
Host column values of the user table row for the account.
rename-user2SHOW SLAVE STATUSSyntax:
SHOW SLAVE STATUS

This statement provides status information on essential parameters of
the slave threads. If you issue this statement using the mysql client,
you can use a \G statement terminator rather than a semicolon to obtain
a more readable vertical layout:

mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
       Slave_IO_State: Waiting for master to send event
          Master_Host: localhost
          Master_User: root
          Master_Port: 3306
        Connect_Retry: 3
      Master_Log_File: gbichot-bin.005
  Read_Master_Log_Pos: 79
       Relay_Log_File: gbichot-relay-bin.005
        Relay_Log_Pos: 548
Relay_Master_Log_File: gbichot-bin.005
     Slave_IO_Running: Yes
    Slave_SQL_Running: Yes
      Replicate_Do_DB:
  Replicate_Ignore_DB:
           Last_Errno: 0
           Last_Error:
         Skip_Counter: 0
  Exec_Master_Log_Pos: 79
      Relay_Log_Space: 552
      Until_Condition: None
       Until_Log_File:
        Until_Log_Pos: 0
   Master_SSL_Allowed: No
   Master_SSL_CA_File:
   Master_SSL_CA_Path:
      Master_SSL_Cert:
    Master_SSL_Cipher:
       Master_SSL_Key:
Seconds_Behind_Master: 8
show-slave-status"GEOMETRYtMySQL provides a standard way of creating spatial columns for geometry
types, for example, with CREATE TABLE or ALTER TABLE. Currently,
spatial columns are supported for MyISAM, InnoDB, NDB, BDB, and ARCHIVE
tables. (Support for storage engines other than MyISAM was added in
MySQL 5.0.16.) See also the annotations about spatial indexes under
[creating-spatial-indexes].
 CREATE TABLE geom (g GEOMETRY);
creating-spatial-columns"	NUMPOINTSONumPoints(ls)

Returns the number of Point objects in the LineString value ls.
mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
mysql> SELECT NumPoints(GeomFromText(@ls));
+------------------------------+
| NumPoints(GeomFromText(@ls)) |
+------------------------------+
|                            3 |
+------------------------------+
linestring-property-functionsX"&Syntax:
&

Bitwise AND:
%mysql> SELECT 29 & 15;
        -> 13

bit-functions2LOCALTIMESTAMPfSyntax:
LOCALTIMESTAMP, LOCALTIMESTAMP()

LOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().
date-and-time-functions"ADDDATECSyntax:
ADDDATE(date,INTERVAL expr type), ADDDATE(expr,days)

When invoked with the INTERVAL form of the second argument, ADDDATE()
is a synonym for DATE_ADD(). The related function SUBDATE() is a
synonym for DATE_SUB(). For information on the INTERVAL argument, see
the discussion for DATE_ADD().

mysql> SELECT DATE_ADD('1998-01-02', INTERVAL 31 DAY);
        -> '1998-02-02'
mysql> SELECT ADDDATE('1998-01-02', INTERVAL 31 DAY);
        -> '1998-02-02'

When invoked with the days form of the second argument, MySQL treats it
as an integer number of days to be added to expr.
Amysql> SELECT ADDDATE('1998-01-02', 31);
        -> '1998-02-02'
date-and-time-functionsL"REPEAT LOOP#Syntax:
[begin_label:] REPEAT
    statement_list
UNTIL search_condition
END REPEAT [end_label]

The statement list within a REPEAT statement is repeated until the
search_condition is true. Thus, a REPEAT always enters the loop at
least once. statement_list consists of one or more statements.

A REPEAT statement can be labeled. end_label cannot be given unless
begin_label also is present. If both are present, they must be the
same.
qmysql> delimiter //

mysql> CREATE PROCEDURE dorepeat(p1 INT)
    -> BEGIN
    ->   SET @x = 0;
    ->   REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
    -> END
    -> //
Query OK, 0 rows affected (0.00 sec)

mysql> CALL dorepeat(1000)//
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @x//
+------+
| @x   |
+------+
| 1001 |
+------+
1 row in set (0.00 sec)
repeat-statement2SMALLINT}SMALLINT[(M)] [UNSIGNED] [ZEROFILL]

A small integer. The signed range is -32768 to 32767. The unsigned
range is 0 to 65535.
numeric-type-overview2DOUBLE PRECISIONDOUBLE PRECISION[(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED]
[ZEROFILL]

These types are synonyms for DOUBLE. Exception: If the REAL_AS_FLOAT
SQL mode is enabled, REAL is a synonym for FLOAT rather than DOUBLE.
numeric-type-overview"ORD!Syntax:
ORD(str)

If the leftmost character of the string str is a multi-byte character,
returns the code for that character, calculated from the numeric values
of its constituent bytes using this formula:

  (1st byte code)
+ (2nd byte code × 256)
+ (3rd byte code × 2562) ...

If the leftmost character is not a multi-byte character, ORD() returns
the same value as the ASCII() function.
&mysql> SELECT ORD('2');
        -> 50
string-functions"ENVELOPE Envelope(g)

Returns the Minimum Bounding Rectangle (MBR) for the geometry value g.
The result is returned as a Polygon value.

The polygon is defined by the corner points of the bounding box:

POLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))
gmysql> SELECT AsText(Envelope(GeomFromText('LineString(1 1,2 2)')));
+-------------------------------------------------------+
| AsText(Envelope(GeomFromText('LineString(1 1,2 2)'))) |
+-------------------------------------------------------+
| POLYGON((1 1,2 1,2 2,1 2,1 1))                        |
+-------------------------------------------------------+
#general-geometry-property-functionss2DEALLOCATE PREPAREQSyntax:
{DEALLOCATE | DROP} PREPARE stmt_name

To deallocate a prepared statement, use the DEALLOCATE PREPARE
statement. Attempting to execute a prepared statement after
deallocating it results in an error.

If you terminate a client session without deallocating a previously
prepared statement, the server deallocates it automatically.
sqlps!2IS_FREE_LOCK
Syntax:
IS_FREE_LOCK(str)

Checks whether the lock named str is free to use (that is, not locked).
Returns 1 if the lock is free (no one is using the lock), 0 if the lock
is in use, and NULL if an error occurs (such as an incorrect argument).
miscellaneous-functionsU2TOUCHESTouches(g1,g2)

Returns 1 or 0 to indicate whether g1 spatially touches g2. Two
geometries spatially touch if the interiors of the geometries do not
intersect, but the boundary of one of the geometries intersects either
the boundary or the interior of the other.
<functions-that-test-spatial-relationships-between-geometries<"	INET_ATON
Syntax:
INET_ATON(expr)

Given the dotted-quad representation of a network address as a string,
returns an integer that represents the numeric value of the address.
Addresses may be 4- or 8-byte addresses.
Amysql> SELECT INET_ATON('209.207.224.40');
        -> 3520061480
miscellaneous-functions"
UNCOMPRESS
.Syntax:
UNCOMPRESS(string_to_uncompress)

Uncompresses a string compressed by the COMPRESS() function. If the
argument is not a compressed value, the result is NULL. This function
requires MySQL to have been compiled with a compression library such as
zlib. Otherwise, the return value is always NULL.
mysql> SELECT UNCOMPRESS(COMPRESS('any string'));
        -> 'any string'
mysql> SELECT UNCOMPRESS('any string');
        -> NULL
encryption-functions"AUTO_INCREMENTUThe AUTO_INCREMENT attribute can be used to generate a unique identity
for new rows:
CREATE TABLE animals (
     id MEDIUMINT NOT NULL AUTO_INCREMENT,
     name CHAR(30) NOT NULL,
     PRIMARY KEY (id)
 );

INSERT INTO animals (name) VALUES 
    ('dog'),('cat'),('penguin'),
    ('lax'),('whale'),('ostrich');

SELECT * FROM animals;
example-auto-incrementi2ISSIMPLE 3IsSimple(g)

Currently, this function is a placeholder and should not be used. If
implemented, its behavior will be as described in the next paragraph.

Returns 1 if the geometry value g has no anomalous geometric points,
such as self-intersection or self-tangency. IsSimple() returns 0 if the
argument is not simple, and -1 if it is NULL.

The description of each instantiable geometric class given earlier in
the chapter includes the specific conditions that cause an instance of
that class to be classified as not simple. (See
[gis-geometry-class-hierarchy].)
#general-geometry-property-functionsb"- BINARYSyntax:
-

Subtraction:
!mysql> SELECT 3-5;
        -> -2
arithmetic-functions2GEOMCOLLFROMTEXTGeomCollFromText(wkt[,srid]), GeometryCollectionFromText(wkt[,srid])

Constructs a GEOMETRYCOLLECTION value using its WKT representation and
SRID.
gis-wkt-functions2WKT DEFINITIONjThe Well-Known Text (WKT) representation of Geometry is designed to
exchange geometry data in ASCII form.
gis-wkt-format2CURRENT_TIMEbSyntax:
CURRENT_TIME, CURRENT_TIME()

CURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().
date-and-time-functionsS2REVOKE<Syntax:
REVOKE priv_type [(column_list)] [, priv_type [(column_list)]] ...
    ON [object_type] {tbl_name | * | *.* | db_name.*}
    FROM user [, user] ...

REVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...

The REVOKE statement enables system administrators to revoke privileges
from MySQL accounts. To use REVOKE, you must have the GRANT OPTION
privilege, and you must have the privileges that you are revoking.

For details on the levels at which privileges exist, the allowable
priv_type values, and the syntax for specifying users and passwords,
see [grant]
revoke0"LAST_INSERT_IDSyntax:
LAST_INSERT_ID(), LAST_INSERT_ID(expr)

Returns the first automatically generated value that was set for an
AUTO_INCREMENT column by the most recent INSERT or UPDATE statement to
affect such a column.
/mysql> SELECT LAST_INSERT_ID();
        -> 195
information-functions"LAST_DAYSyntax:
LAST_DAY(date)

Takes a date or datetime value and returns the corresponding value for
the last day of the month. Returns NULL if the argument is invalid.
mysql> SELECT LAST_DAY('2003-02-05');
        -> '2003-02-28'
mysql> SELECT LAST_DAY('2004-02-05');
        -> '2004-02-29'
mysql> SELECT LAST_DAY('2004-01-01 01:01:01');
        -> '2004-01-31'
mysql> SELECT LAST_DAY('2003-03-32');
        -> NULL
date-and-time-functions2	MEDIUMINTMEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]

A medium-sized integer. The signed range is -8388608 to 8388607. The
unsigned range is 0 to 16777215.
numeric-type-overview"FLOORHSyntax:
FLOOR(X)

Returns the largest integer value not greater than X.
Rmysql> SELECT FLOOR(1.23);
        -> 1
mysql> SELECT FLOOR(-1.23);
        -> -2
mathematical-functions"RTRIM!SSyntax:
RTRIM(str)

Returns the string str with trailing space characters removed.
6mysql> SELECT RTRIM('barbar   ');
        -> 'barbar'
string-functions"DEGREESOSyntax:
DEGREES(X)

Returns the argument X, converted from radians to degrees.
[mysql> SELECT DEGREES(PI());
        -> 180
mysql> SELECT DEGREES(PI() / 2);
        -> 90
mathematical-functionsb2EXPLAINISyntax:
EXPLAIN tbl_name

Or:

EXPLAIN [EXTENDED] SELECT select_options

The EXPLAIN statement can be used either as a synonym for DESCRIBE or
as a way to obtain information about how MySQL executes a SELECT
statement:

o EXPLAIN tbl_name is synonymous with DESCRIBE tbl_name or SHOW COLUMNS
  FROM tbl_name.

o When you precede a SELECT statement with the keyword EXPLAIN, MySQL
  displays information from the optimizer about the query execution
  plan. That is, MySQL explains how it would process the SELECT,
  including information about how tables are joined and in which order.
explainr2VARCHARL[NATIONAL] VARCHAR(M)

A variable-length string. M represents the maximum column length. In
MySQL 5.0, the range of M is 0 to 255 before MySQL 5.0.3, and 0 to
65,535 in MySQL 5.0.3 and later. (The actual maximum length of a
VARCHAR in MySQL 5.0 is determined by the maximum row size and the
character set you use. The maximum effective length starting with MySQL
5.0.3 is 65,532 bytes.)

Note: Before 5.0.3, trailing spaces were removed when VARCHAR values
were stored, which differs from the standard SQL specification.

Prior to MySQL 5.0.3, a VARCHAR column with a length specification
greater than 255 was converted to the smallest TEXT type that could
hold values of the given length. For example, VARCHAR(500) was
converted to TEXT, and VARCHAR(200000) was converted to MEDIUMTEXT.
This was a compatibility feature. However, this conversion affected
trailing-space removal.

VARCHAR is shorthand for CHARACTER VARYING.

VARCHAR values are stored using as many characters as are needed, plus
one byte to record the length (two bytes for columns that are declared
with a length longer than 255).
string-type-overview"UNHEX!
Syntax:

UNHEX(str)

Performs the inverse operation of HEX(str). That is, it interprets each
pair of hexadecimal digits in the argument as a number and converts it
to the character represented by the number. The resulting characters
are returned as a binary string.
mysql> SELECT UNHEX('4D7953514C');
        -> 'MySQL'
mysql> SELECT 0x4D7953514C;
        -> 'MySQL'
mysql> SELECT UNHEX(HEX('string'));
        -> 'string'
mysql> SELECT HEX(UNHEX('1267'));
        -> '1267'
string-functions"- UNARYHSyntax:
-

Unary minus. This operator changes the sign of the argument.
!mysql> SELECT - 2;
        -> -2
arithmetic-functions"SELECT INTO#Syntax:
SELECT col_name[,...] INTO var_name[,...] table_expr

This SELECT syntax stores selected columns directly into variables.
Therefore, only a single row may be retrieved.
.SELECT id,data INTO x,y FROM test.t1 LIMIT 1;
select-into-statement"COSFSyntax:
COS(X)

Returns the cosine of X, where X is given in radians.
'mysql> SELECT COS(PI());
        -> -1
mathematical-functions"
DATE FUNCTIONTSyntax:
DATE(expr)

Extracts the date part of the date or datetime expression expr.
Cmysql> SELECT DATE('2003-12-31 01:02:03');
        -> '2003-12-31'
date-and-time-functions32DROP TRIGGERSyntax:
DROP TRIGGER [schema_name.]trigger_name

This statement drops a trigger. The schema (database) name is optional.
If the schema is omitted, the trigger is dropped from the default
schema. DROP TRIGGER was added in MySQL 5.0.2. Its use requires the
SUPER privilege.
drop-trigger2RESET MASTERSyntax:
RESET MASTER

Deletes all binary logs listed in the index file, resets the binary log
index file to be empty, and creates a new binary log file.
reset-master"TANGSyntax:
TAN(X)

Returns the tangent of X, where X is given in radians.
omysql> SELECT TAN(PI());
        -> -1.2246063538224e-16
mysql> SELECT TAN(PI()+1);
        -> 1.5574077246549
mathematical-functions9"PISyntax:
PI()

Returns the value of π (pi). The default number of decimal places
displayed is seven, but MySQL uses the full double-precision value
internally.
qmysql> SELECT PI();
        -> 3.141593
mysql> SELECT PI()+0.000000000000000000;
        -> 3.141592653589793116
mathematical-functions"
WEEKOFYEARSyntax:
WEEKOFYEAR(date)

Returns the calendar week of the date as a number in the range from 1
to 53. WEEKOFYEAR() is a compatibility function that is equivalent to
WEEK(date,3).
5mysql> SELECT WEEKOFYEAR('1998-02-20');
        -> 8
date-and-time-functionsZ"/Syntax:
/

Division:
#mysql> SELECT 3/5;
        -> 0.60
arithmetic-functions2STDDEV_SAMPSyntax:
STDDEV_SAMP(expr)

Returns the sample standard deviation of expr (the square root of
VAR_SAMP(). This function was added in MySQL 5.0.3.

STDDEV_SAMP() returns NULL if there were no matching rows.
group-by-functions2SCHEMAZSyntax:
SCHEMA()

This function is a synonym for DATABASE(). It was added in MySQL 5.0.2.
information-functions2MLINEFROMWKBMLineFromWKB(wkb[,srid]), MultiLineStringFromWKB(wkb[,srid])

Constructs a MULTILINESTRING value using its WKB representation and
SRID.
gis-wkb-functions"LOG24Syntax:
LOG2(X)

Returns the base-2 logarithm of X.
Smysql> SELECT LOG2(65536);
        -> 16
mysql> SELECT LOG2(-100);
        -> NULL
mathematical-functions"SUBTIMESyntax:
SUBTIME(expr,expr2)

SUBTIME() subtracts expr2 from expr and returns the result. expr is a
time or datetime expression, and expr2 is a time expression.
mysql> SELECT SUBTIME('1997-12-31 23:59:59.999999','1 1:1:1.000002');
        -> '1997-12-30 22:58:58.999997'
mysql> SELECT SUBTIME('01:00:00.999999', '02:00:00.999998');
        -> '-00:59:59.999999'
date-and-time-functions"UNCOMPRESSED_LENGTH
{Syntax:
UNCOMPRESSED_LENGTH(compressed_string)

Returns the length that the compressed string had before being
compressed.
Kmysql> SELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT('a',30)));
        -> 30
encryption-functions2
DROP TABLE$Syntax:
DROP [TEMPORARY] TABLE [IF EXISTS]
    tbl_name [, tbl_name] ...
    [RESTRICT | CASCADE]

DROP TABLE removes one or more tables. You must have the DROP privilege
for each table. All table data and the table definition are removed, so
be careful with this statement!

Use IF EXISTS to prevent an error from occurring for tables that do not
exist. A NOTE is generated for each non-existent table when using IF
EXISTS. See [show-warnings].

RESTRICT and CASCADE are allowed to make porting easier. For the
moment, they do nothing.

Note: DROP TABLE automatically commits the current active transaction,
unless you use the TEMPORARY keyword.

drop-table<"SHOW CREATE TABLESyntax:
SHOW CREATE TABLE tbl_name

Shows the CREATE TABLE statement that creates the given table. As of
MySQL 5.0.1, this statement also works with views.
SHOW CREATE TABLE quotes table and column names according to the value
of the SQL_QUOTE_SHOW_CREATE option. See [set-option].
mysql> SHOW CREATE TABLE t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE t (
  id INT(11) default NULL auto_increment,
  s char(60) default NULL,
  PRIMARY KEY (id)
) ENGINE=MyISAM
show-create-tableD2DUAL/You are allowed to specify DUAL as a dummy table name in situations
where no tables are referenced:

mysql> SELECT 1 + 1 FROM DUAL;
        -> 2

DUAL is purely for compatibility with some other database servers that
require a FROM clause. MySQL does not require the clause if no tables
are referenced.
selectb"INSTR!Syntax:
INSTR(str,substr)

Returns the position of the first occurrence of substring substr in
string str. This is the same as the two-argument form of LOCATE(),
except that the order of the arguments is reversed.
jmysql> SELECT INSTR('foobarbar', 'bar');
        -> 4
mysql> SELECT INSTR('xbar', 'foobar');
        -> 0
string-functionsI"NOWSyntax:
NOW()

Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS'
or YYYYMMDDHHMMSS format, depending on whether the function is used in
a string or numeric context.
imysql> SELECT NOW();
        -> '1997-12-15 23:50:26'
mysql> SELECT NOW() + 0;
        -> 19971215235026
date-and-time-functions02SHOW ENGINES
Syntax:
SHOW [STORAGE] ENGINES

SHOW ENGINES displays status information about the server's storage
engines. This is particularly useful for checking whether a storage
engine is supported, or to see what the default engine is. SHOW TABLE
TYPES is a deprecated synonym.
show-enginesi">=#Syntax:
>=

Greater than or equal:
#mysql> SELECT 2 >= 2;
        -> 1
comparison-operators"EXPbSyntax:
EXP(X)

Returns the value of e (the base of natural logarithms) raised to the
power of X.
mysql> SELECT EXP(2);
        -> 7.3890560989307
mysql> SELECT EXP(-2);
        -> 0.13533528323661
mysql> SELECT EXP(0);
        -> 1
mathematical-functions"SHA
Syntax:
SHA1(str), SHA(str)

Calculates an SHA-1 160-bit checksum for the string, as described in
RFC 3174 (Secure Hash Algorithm). The value is returned as a binary
string of 40 hex digits, or NULL if the argument was NULL. One of the
possible uses for this function is as a hash key. You can also use it
as a cryptographic function for storing passwords. SHA() is synonymous
with SHA1().
Qmysql> SELECT SHA1('abc');
        -> 'a9993e364706816aba3e25717850c26c9cd0d89d'
encryption-functions2LONGBLOBLONGBLOB

A BLOB column with a maximum length of 4,294,967,295 or 4GB (232 - 1)
bytes. The maximum effective (permitted) length of LONGBLOB columns
depends on the configured maximum packet size in the client/server
protocol and available memory.
string-type-overview"POINTNgPointN(ls,N)

Returns the N-th Point in the Linestring value ls. Points are numbered
beginning with 1.
'mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
mysql> SELECT AsText(PointN(GeomFromText(@ls),2));
+-------------------------------------+
| AsText(PointN(GeomFromText(@ls),2)) |
+-------------------------------------+
| POINT(2 2)                          |
+-------------------------------------+
linestring-property-functions2YEAR DATA TYPEzYEAR[(2|4)]

A year in two-digit or four-digit format. The default is four-digit
format. In four-digit format, the allowable values are 1901 to 2155,
and 0000. In two-digit format, the allowable values are 70 to 69,
representing years from 1970 to 2069. MySQL displays YEAR values in
YYYY format, but allows you to assign values to YEAR columns using
either strings or numbers.
date-and-time-type-overview2SUMSyntax:
SUM([DISTINCT] expr)

Returns the sum of expr. If the return set has no rows, SUM() returns
NULL. The DISTINCT keyword can be used in MySQL 5.0 to sum only the
distinct values of expr.

SUM() returns NULL if there were no matching rows.
group-by-functions"OCT!Syntax:
OCT(N)

Returns a string representation of the octal value of N, where N is a
longlong (BIGINT) number. This is equivalent to CONV(N,10,8). Returns
NULL if N is NULL.
'mysql> SELECT OCT(12);
        -> '14'
string-functions2SYSDATESyntax:
SYSDATE()

Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS'
or YYYYMMDDHHMMSS format, depending on whether the function is used in
a string or numeric context.

As of MySQL 5.0.13, SYSDATE() returns the time at which it executes.
This differs from the behavior for NOW(), which returns a constant time
that indicates the time at which the statement began to execute.
(Within a stored routine or trigger, NOW() returns the time at which
the routine or triggering statement began to execute.)

mysql> SELECT NOW(), SLEEP(2), NOW();
+---------------------+----------+---------------------+
| NOW()               | SLEEP(2) | NOW()               |
+---------------------+----------+---------------------+
| 2006-04-12 13:47:36 |        0 | 2006-04-12 13:47:36 |
+---------------------+----------+---------------------+

mysql> SELECT SYSDATE(), SLEEP(2), SYSDATE();
+---------------------+----------+---------------------+
| SYSDATE()           | SLEEP(2) | SYSDATE()           |
+---------------------+----------+---------------------+
| 2006-04-12 13:47:44 |        0 | 2006-04-12 13:47:46 |
+---------------------+----------+---------------------+

In addition, the SET TIMESTAMP statement affects the value returned by
NOW() but not by SYSDATE(). This means that timestamp settings in the
binary log have no effect on invocations of SYSDATE().

Because SYSDATE() can return different values even within the same
statement, and is not affected by SET TIMESTAMP, it is
non-deterministic and therefore unsafe for replication. If that is a
problem, you can start the server with the --sysdate-is-now option to
cause SYSDATE() to be an alias for NOW().
date-and-time-functions"ASBINARYsAsBinary(g)

Converts a value in internal geometry format to its WKB representation
and returns the binary result.
SELECT AsBinary(g) FROM geom;
/functions-to-convert-geometries-between-formats#"REPEAT FUNCTION!Syntax:
REPEAT(str,count)

Returns a string consisting of the string str repeated count times. If
count is less than 1, returns an empty string. Returns NULL if str or
count are NULL.
?mysql> SELECT REPEAT('MySQL', 3);
        -> 'MySQLMySQLMySQL'
string-functions2SHOW TABLESSyntax:
SHOW [FULL] TABLES [FROM db_name] [LIKE 'pattern']

SHOW TABLES lists the non-TEMPORARY tables in a given database. You can
also get this list using the mysqlshow db_name command.

Before MySQL 5.0.1, the output from SHOW TABLES contains a single
column of table names. Beginning with MySQL 5.0.1, this statement also
lists any views in the database. As of MySQL 5.0.2, the FULL modifier
is supported such that SHOW FULL TABLES displays a second output
column. Values for the second column are BASE TABLE for a table and
VIEW for a view.

Note: If you have no privileges for a table, the table does not show up
in the output from SHOW TABLES or mysqlshow db_name.
show-tables"MAKEDATESyntax:
MAKEDATE(year,dayofyear)

Returns a date, given year and day-of-year values. dayofyear must be
greater than 0 or the result is NULL.
mysql> SELECT MAKEDATE(2001,31), MAKEDATE(2001,32);
        -> '2001-01-31', '2001-02-01'
mysql> SELECT MAKEDATE(2001,365), MAKEDATE(2004,365);
        -> '2001-12-31', '2004-12-30'
mysql> SELECT MAKEDATE(2001,0);
        -> NULL
date-and-time-functions/"	BINARY OPERATOR!]Syntax:
BINARY

The BINARY operator casts the string following it to a binary string.
This is an easy way to force a column comparison to be done byte by
byte rather than character by character. This causes the comparison to
be case sensitive even if the column isn't defined as BINARY or BLOB.
BINARY also causes trailing spaces to be significant.
mysql> SELECT 'a' = 'A';
        -> 1
mysql> SELECT BINARY 'a' = 'A';
        -> 0
mysql> SELECT 'a' = 'a ';
        -> 1
mysql> SELECT BINARY 'a' = 'a ';
        -> 0
cast-functions2
MBROVERLAPSMBROverlaps(g1,g2)

Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of
the two geometries g1 and g2 overlap.
relations-on-geometry-mbrZ"SOUNDEX!Syntax:
SOUNDEX(str)

Returns a soundex string from str. Two strings that sound almost the
same should have identical soundex strings. A standard soundex string
is four characters long, but the SOUNDEX() function returns an
arbitrarily long string. You can use SUBSTRING() on the result to get a
standard soundex string. All non-alphabetic characters in str are
ignored. All international alphabetic characters outside the A-Z range
are treated as vowels.
nmysql> SELECT SOUNDEX('Hello');
        -> 'H400'
mysql> SELECT SOUNDEX('Quadratically');
        -> 'Q36324'
string-functions2SHOW MASTER LOGSSyntax:
SHOW MASTER LOGS
SHOW BINARY LOGS

Lists the binary log files on the server. This statement is used as
part of the procedure described in [purge-master-logs], that shows how
to determine which logs can be purged.

mysql> SHOW BINARY LOGS;
+---------------+-----------+
| Log_name      | File_size |
+---------------+-----------+
| binlog.000015 |    724935 |
| binlog.000016 |    733481 |
+---------------+-----------+
show-master-logs2

MBRTOUCHES}MBRTouches(g1,g2)

Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of
the two geometries g1 and g2 touch.
relations-on-geometry-mbr
s"CREATE PROCEDURE#Syntax:
CREATE
    [DEFINER = { user | CURRENT_USER }]
    PROCEDURE sp_name ([proc_parameter[,...]])
    [characteristic ...] routine_body

CREATE
    [DEFINER = { user | CURRENT_USER }]
    FUNCTION sp_name ([func_parameter[,...]])
    RETURNS type
    [characteristic ...] routine_body
    
proc_parameter:
    [ IN | OUT | INOUT ] param_name type
    
func_parameter:
    param_name type

type:
    Any valid MySQL data type

characteristic:
    LANGUAGE SQL
  | [NOT] DETERMINISTIC
  | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
  | SQL SECURITY { DEFINER | INVOKER }
  | COMMENT 'string'

routine_body:
    Valid SQL procedure statement

These statements create stored routines. As of MySQL 5.0.3, to use
them, it is necessary to have the CREATE ROUTINE privilege. If binary
logging is enabled, these statements might may also require the SUPER
privilege, as described in [stored-procedure-logging]. MySQL
automatically grants the ALTER ROUTINE and EXECUTE privileges to the
routine creator.

By default, the routine is associated with the default database. To
associate the routine explicitly with a given database, specify the
name as db_name.sp_name when you create it.

If the routine name is the same as the name of a built-in SQL function,
you must use a space between the name and the following parenthesis
when defining the routine, or a syntax error occurs. This is also true
when you invoke the routine later. For this reason, we suggest that it
is better to avoid re-using the names of existing SQL functions for
your own stored routines.

The IGNORE_SPACE SQL mode applies to built-in functions, not to stored
routines. it is always allowable to have spaces after a routine name,
regardless of whether IGNORE_SPACE is enabled.

The parameter list enclosed within parentheses must always be present.
If there are no parameters, an empty parameter list of () should be
used. Each parameter is an IN parameter by default. To specify
otherwise for a parameter, use the keyword OUT or INOUT before the
parameter name.

Note: Specifying a parameter as IN, OUT, or INOUT is valid only for a
PROCEDURE. (FUNCTION parameters are always regarded as IN parameters.)

Each parameter can be declared to use any valid data type, except that
the COLLATE attribute cannot be used.

The RETURNS clause may be specified only for a FUNCTION, for which it
is mandatory. It indicates the return type of the function, and the
function body must contain a RETURN value statement.

The routine_body consists of a valid SQL procedure statement. This can
be a simple statement such as SELECT or INSERT, or it can be a compound
statement written using BEGIN and END. Compound statement syntax is
described in [begin-end]. Compound statements can contain declarations,
loops, and other control structure statements. The syntax for these
statements is described later in this chapter. See, for example,
[declare], and [flow-control-constructs]. Some statements are not
allowed in stored routines; see [routine-restrictions].
lmysql> delimiter //

mysql> CREATE PROCEDURE simpleproc (OUT param1 INT)
    -> BEGIN
    ->   SELECT COUNT(*) INTO param1 FROM t;
    -> END;
    -> //
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;

mysql> CALL simpleproc(@a);
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @a;
+------+
| @a   |
+------+
| 3    |
+------+
1 row in set (0.00 sec)
create-procedure2
INSERT SELECTSyntax:
INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
    [INTO] tbl_name [(col_name,...)]
    SELECT ...
    [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]

With INSERT ... SELECT, you can quickly insert many rows into a table
from one or many tables. For example:

INSERT INTO tbl_temp2 (fld_id)
  SELECT tbl_temp1.fld_order_id
  FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;

insert-select2	VARBINARYVARBINARY(M)

The VARBINARY type is similar to the VARCHAR type, but stores binary
byte strings rather than non-binary character strings.
string-type-overview2
LOAD INDEXSyntax:
LOAD INDEX INTO CACHE
  tbl_index_list [, tbl_index_list] ...

tbl_index_list:
  tbl_name
    [[INDEX|KEY] (index_name[, index_name] ...)]
    [IGNORE LEAVES]

The LOAD INDEX INTO CACHE statement preloads a table index into the key
cache to which it has been assigned by an explicit CACHE INDEX
statement, or into the default key cache otherwise. LOAD INDEX INTO
CACHE is used only for MyISAM tables.

The IGNORE LEAVES modifier causes only blocks for the non-leaf nodes of
the index to be preloaded.

load-index22UNIONSyntax:
SELECT ...
UNION [ALL | DISTINCT] SELECT ...
[UNION [ALL | DISTINCT] SELECT ...]

UNION is used to combine the result from multiple SELECT statements
into a single result set.

The column names from the first SELECT statement are used as the column
names for the results returned. Selected columns listed in
corresponding positions of each SELECT statement should have the same
data type. (For example, the first column selected by the first
statement should have the same type as the first column selected by the
other statements.)
union"TO_DAYSbSyntax:
TO_DAYS(date)

Given a date date, returns a day number (the number of days since year
0).
hmysql> SELECT TO_DAYS(950501);
        -> 728779
mysql> SELECT TO_DAYS('1997-10-07');
        -> 729669
date-and-time-functions2
NOT REGEXP!\Syntax:
expr NOT REGEXP pat, expr NOT RLIKE pat

This is the same as NOT (expr REGEXP pat).
string-comparison-functions2
SHOW INDEXSyntax:
SHOW INDEX FROM tbl_name [FROM db_name]

SHOW INDEX returns table index information. The format resembles that
of the SQLStatistics call in ODBC.
You can use db_name.tbl_name as an alternative to the tbl_name FROM
db_name syntax. These two statements are equivalent:

SHOW INDEX FROM mytable FROM mydb;
SHOW INDEX FROM mydb.mytable;

SHOW KEYS is a synonym for SHOW INDEX. You can also list a table's
indexes with the mysqlshow -k db_name tbl_name command.

show-index"SHOW CREATE DATABASESyntax:
SHOW CREATE {DATABASE | SCHEMA} db_name

Shows the CREATE DATABASE statement that creates the given database.
SHOW CREATE SCHEMA is a synonym for SHOW CREATE DATABASE as of MySQL
5.0.2.
mysql> SHOW CREATE DATABASE test\G
*************************** 1. row ***************************
       Database: test
Create Database: CREATE DATABASE `test`
                 /*!40100 DEFAULT CHARACTER SET latin1 */

mysql> SHOW CREATE SCHEMA test\G
*************************** 1. row ***************************
       Database: test
Create Database: CREATE DATABASE `test`
                 /*!40100 DEFAULT CHARACTER SET latin1 */
show-create-database2LEAVE#Syntax:
LEAVE label

This statement is used to exit any labeled flow control construct. It
can be used within BEGIN ... END or loop constructs (LOOP, REPEAT,
WHILE).
leave-statementu2NOT INPSyntax:
expr NOT IN (value,...)

This is the same as NOT (expr IN (value,...)).
comparison-operatorsO"!}Syntax:
NOT, !

Logical NOT. Evaluates to 1 if the operand is 0, to 0 if the operand is
non-zero, and NOT NULL returns NULL.
mysql> SELECT NOT 10;
        -> 0
mysql> SELECT NOT 0;
        -> 1
mysql> SELECT NOT NULL;
        -> NULL
mysql> SELECT ! (1+1);
        -> 0
mysql> SELECT ! 1+1;
        -> 1
logical-operators<"DECLARE HANDLER#Syntax:
DECLARE handler_type HANDLER FOR condition_value[,...] statement

handler_type:
    CONTINUE
  | EXIT
  | UNDO

condition_value:
    SQLSTATE [VALUE] sqlstate_value
  | condition_name
  | SQLWARNING
  | NOT FOUND
  | SQLEXCEPTION
  | mysql_error_code

The DECLARE ... HANDLER statement specifies handlers that each may deal
with one or more conditions. If one of these conditions occurs, the
specified statement is executed. statement can be a simple statement
(for example, SET var_name = value), or it can be a compound statement
written using BEGIN and END (see [begin-end]).

For a CONTINUE handler, execution of the current routine continues
after execution of the handler statement. For an EXIT handler,
execution terminates for the BEGIN ... END compound statement in which
the handler is declared. (This is true even if the condition occurs in
an inner block.) The UNDO handler type statement is not yet supported.

If a condition occurs for which no handler has been declared, the
default action is EXIT.

A condition_value can be any of the following values:

o An SQLSTATE value or a MySQL error code.

o A condition name previously specified with DECLARE ... CONDITION. See
  [declare-conditions].

o SQLWARNING is shorthand for all SQLSTATE codes that begin with 01.

o NOT FOUND is shorthand for all SQLSTATE codes that begin with 02.

o SQLEXCEPTION is shorthand for all SQLSTATE codes not caught by
  SQLWARNING or NOT FOUND.
fmysql> CREATE TABLE test.t (s1 int,primary key (s1));
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter //

mysql> CREATE PROCEDURE handlerdemo ()
    -> BEGIN
    ->   DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
    ->   SET @x = 1;
    ->   INSERT INTO test.t VALUES (1);
    ->   SET @x = 2;
    ->   INSERT INTO test.t VALUES (1);
    ->   SET @x = 3;
    -> END;
    -> //
Query OK, 0 rows affected (0.00 sec)

mysql> CALL handlerdemo()//
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @x//
    +------+
    | @x   |
    +------+
    | 3    |
    +------+
    1 row in set (0.00 sec)
declare-handlers2DOUBLEDOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]

A normal-size (double-precision) floating-point number. Allowable
values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and
2.2250738585072014E-308 to 1.7976931348623157E+308. These are the
theoretical limits, based on the IEEE standard. The actual range might
be slightly smaller depending on your hardware or operating system.

M is the total number of decimal digits and D is the number of digits
following the decimal point. If M and D are omitted, values are stored
to the limits allowed by the hardware. A double-precision
floating-point number is accurate to approximately 15 decimal places.

UNSIGNED, if specified, disallows negative values.
numeric-type-overview2TIMETIME

A time. The range is '-838:59:59' to '838:59:59'. MySQL displays TIME
values in 'HH:MM:SS' format, but allows you to assign values to TIME
columns using either strings or numbers.
date-and-time-type-overviews"&&Syntax:
AND, &&

Logical AND. Evaluates to 1 if all operands are non-zero and not NULL,
to 0 if one or more operands are 0, otherwise NULL is returned.
mysql> SELECT 1 && 1;
        -> 1
mysql> SELECT 1 && 0;
        -> 0
mysql> SELECT 1 && NULL;
        -> NULL
mysql> SELECT 0 && NULL;
        -> 0
mysql> SELECT NULL && 0;
        -> 0
logical-operators@"X	SX(p)

Returns the X-coordinate value for the point p as a double-precision
number.
mysql> SET @pt = 'Point(56.7 53.34)';
mysql> SELECT X(GeomFromText(@pt));
+----------------------+
| X(GeomFromText(@pt)) |
+----------------------+
|                 56.7 |
+----------------------+
point-property-functions2"
FOUND_ROWSSyntax:
FOUND_ROWS()

A SELECT statement may include a LIMIT clause to restrict the number of
rows the server returns to the client. In some cases, it is desirable
to know how many rows the statement would have returned without the
LIMIT, but without running the statement again. To obtain this row
count, include a SQL_CALC_FOUND_ROWS option in the SELECT statement,
and then invoke FOUND_ROWS() afterward:
nmysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name
    -> WHERE id > 100 LIMIT 10;
mysql> SELECT FOUND_ROWS();
information-functionsi2 SYSTEM_USER>Syntax:
SYSTEM_USER()

SYSTEM_USER() is a synonym for USER().
information-functions]2!CROSSESCrosses(g1,g2)

Returns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon
or a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,
returns 0.

The term spatially crosses denotes a spatial relation between two given
geometries that has the following properties:

o The two geometries intersect

o Their intersection results in a geometry that has a dimension that is
  one less than the maximum dimension of the two given geometries

o Their intersection is not equal to either of the two given geometries
<functions-that-test-spatial-relationships-between-geometries2"TRUNCATE TABLE~Syntax:
TRUNCATE [TABLE] tbl_name

TRUNCATE TABLE empties a table completely. Logically, this is
equivalent to a DELETE statement that deletes all rows, but there are
practical differences under some circumstances.

For InnoDB before version 5.0.3, TRUNCATE TABLE is mapped to DELETE, so
there is no difference. Starting with MySQL 5.0.3, fast TRUNCATE TABLE
is available. However, the operation is still mapped to DELETE if there
are foreign key constraints that reference the table. (When fast
truncate is used, it resets any AUTO_INCREMENT counter. From MySQL
5.0.13 on, the AUTO_INCREMENT counter is reset by TRUNCATE TABLE,
regardless of whether there is a foreign key constraint.)

For other storage engines, TRUNCATE TABLE differs from DELETE in the
following ways in MySQL 5.0:

o Truncate operations drop and re-create the table, which is much
  faster than deleting rows one by one.

o Truncate operations are not transaction-safe; an error occurs when
  attempting one in the course of an active transaction or active table
  lock.

o The number of deleted rows is not returned.

o As long as the table format file tbl_name.frm is valid, the table can
  be re-created as an empty table with TRUNCATE TABLE, even if the data
  or index files have become corrupted.

o The table handler does not remember the last used AUTO_INCREMENT
  value, but starts counting from the beginning. This is true even for
  MyISAM and InnoDB, which normally do not reuse sequence values.

Since truncation of a table does not make any use of DELETE, the
TRUNCATE statement does not invoke ON DELETE triggers.

TRUNCATE TABLE is an Oracle SQL extension adopted in MySQL.
truncate2#BIT_XORSyntax:
BIT_XOR(expr)

Returns the bitwise XOR of all bits in expr. The calculation is
performed with 64-bit (BIGINT) precision.
group-by-functions2$CURRENT_DATEbSyntax:
CURRENT_DATE, CURRENT_DATE()

CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().
date-and-time-functions"%AREAArea(poly)

Returns as a double-precision number the area of the Polygon value
poly, as measured in its spatial reference system.
mysql> SET @poly = 'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))';
mysql> SELECT Area(GeomFromText(@poly));
+---------------------------+
| Area(GeomFromText(@poly)) |
+---------------------------+
|                         4 |
+---------------------------+
polygon-property-functions!2&START SLAVESyntax:
START SLAVE [thread_type [, thread_type] ... ]
START SLAVE [SQL_THREAD] UNTIL
    MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos
START SLAVE [SQL_THREAD] UNTIL
    RELAY_LOG_FILE = 'log_name', RELAY_LOG_POS = log_pos

thread_type: IO_THREAD | SQL_THREAD

START SLAVE with no thread_type options starts both of the slave
threads. The I/O thread reads queries from the master server and stores
them in the relay log. The SQL thread reads the relay log and executes
the queries. START SLAVE requires the SUPER privilege.

If START SLAVE succeeds in starting the slave threads, it returns
without any error. However, even in that case, it might be that the
slave threads start and then later stop (for example, because they do
not manage to connect to the master or read its binary logs, or some
other problem). START SLAVE does not warn you about this. You must
check the slave's error log for error messages generated by the slave
threads, or check that they are running satisfactorily with SHOW SLAVE
STATUS.
start-slave2'	BEGIN END#Syntax:
[begin_label:] BEGIN
    [statement_list]
END [end_label]

BEGIN ... END syntax is used for writing compound statements, which can
appear within stored routines and triggers. A compound statement can
contain multiple statements, enclosed by the BEGIN and END keywords.
statement_list represents a list of one or more statements. Each
statement within statement_list must be terminated by a semicolon (;)
statement delimiter. Note that statement_list is optional, which means
that the empty compound statement (BEGIN END) is legal.

Use of multiple statements requires that a client is able to send
statement strings containing the ; statement delimiter. This is handled
in the mysql command-line client with the delimiter command. Changing
the ; end-of-statement delimiter (for example, to //) allows ; to be
used in a routine body. For an example, see [create-procedure].

A compound statement can be labeled. end_label cannot be given unless
begin_label also is present. If both are present, they must be the
same.
	begin-end2(FLUSHSyntax:
FLUSH [LOCAL | NO_WRITE_TO_BINLOG] flush_option [, flush_option] ...

The FLUSH statement clears or reloads various internal caches used by
MySQL. To execute FLUSH, you must have the RELOAD privilege.

The RESET statement is similar to FLUSH. See [reset].
flush")SHOW PROCEDURE STATUSiSyntax:
SHOW {PROCEDURE | FUNCTION} STATUS [LIKE 'pattern']

This statement is a MySQL extension. It returns characteristics of
routines, such as the database, name, type, creator, and creation and
modification dates. If no pattern is specified, the information for all
stored procedures or all stored functions is listed, depending on which
statement you use.
9mysql> SHOW FUNCTION STATUS LIKE 'hello'\G
*************************** 1. row ***************************
           Db: test
         Name: hello
         Type: FUNCTION
      Definer: testuser@localhost
     Modified: 2004-08-03 15:29:37
      Created: 2004-08-03 15:29:37
Security_type: DEFINER
      Comment:
show-procedure-status2*
SHOW WARNINGSSyntax:
SHOW WARNINGS [LIMIT [offset,] row_count]
SHOW COUNT(*) WARNINGS

SHOW WARNINGS shows the error, warning, and note messages that resulted
from the last statement that generated messages, or nothing if the last
statement that used a table generated no messages. A related statement,
SHOW ERRORS, shows only the errors. See [show-errors].

The list of messages is reset for each new statement that uses a table.

The SHOW COUNT(*) WARNINGS statement displays the total number of
errors, warnings, and notes. You can also retrieve this number from the
warning_count variable:

SHOW COUNT(*) WARNINGS;
SELECT @@warning_count;

The value of warning_count might be greater than the number of messages
displayed by SHOW WARNINGS if the max_error_count system variable is
set so low that not all messages are stored. An example shown later in
this section demonstrates how this can happen.

The LIMIT clause has the same syntax as for the SELECT statement. See
[select].

show-warnings2+DESCRIBESyntax:
{DESCRIBE | DESC} tbl_name [col_name | wild]

DESCRIBE provides information about the columns in a table. It is a
shortcut for SHOW COLUMNS FROM. As of MySQL 5.0.1, these statements
also display information for views. (See [show-columns].)
describer2,	DROP USERUSyntax:
DROP USER user [, user] ...

The DROP USER statement removes one or more MySQL accounts. To use it,
you must have the global CREATE USER privilege or the DELETE privilege
for the mysql database. Each account is named using the same format as
for the GRANT statement; for example, 'jeffrey'@'localhost'. The user
and host parts of the account name correspond to the User and Host
column values of the user table row for the account.

DROP USER as present in MySQL 5.0.0 removes only accounts that have no
privileges. In MySQL 5.0.2, it was modified to remove account
privileges as well. This means that the procedure for removing an
account depends on your version of MySQL.

As of MySQL 5.0.2, you can remove an account and its privileges as
follows:

DROP USER user;

The statement removes privilege rows for the account from all grant
tables.
	drop-userN2-
STDDEV_POP'Syntax:
STDDEV_POP(expr)

Returns the population standard deviation of expr (the square root of
VAR_POP()). This function was added in MySQL 5.0.3. Before 5.0.3, you
can use STD() or STDDEV(), which are equivalent but not standard SQL.

STDDEV_POP() returns NULL if there were no matching rows.
group-by-functionsd2.SHOW CHARACTER SET5Syntax:
SHOW CHARACTER SET [LIKE 'pattern']

The SHOW CHARACTER SET statement shows all available character sets. It
takes an optional LIKE clause that indicates which character set names
to match. For example:

mysql> SHOW CHARACTER SET LIKE 'latin%';
+---------+-----------------------------+-------------------+--------+
| Charset | Description                 | Default collation | Maxlen |
+---------+-----------------------------+-------------------+--------+
| latin1  | cp1252 West European        | latin1_swedish_ci |      1 |
| latin2  | ISO 8859-2 Central European | latin2_general_ci |      1 |
| latin5  | ISO 8859-9 Turkish          | latin5_turkish_ci |      1 |
| latin7  | ISO 8859-13 Baltic          | latin7_general_ci |      1 |
+---------+-----------------------------+-------------------+--------+
show-character-set"/	SUBSTRING!cSyntax:
SUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len),
SUBSTRING(str FROM pos FOR len)

The forms without a len argument return a substring from string str
starting at position pos. The forms with a len argument return a
substring len characters long from string str, starting at position
pos. The forms that use FROM are standard SQL syntax. It is also
possible to use a negative value for pos. In this case, the beginning
of the substring is pos characters from the end of the string, rather
than the beginning. A negative value may be used for pos in any of the
forms of this function.
mysql> SELECT SUBSTRING('Quadratically',5);
        -> 'ratically'
mysql> SELECT SUBSTRING('foobarbar' FROM 4);
        -> 'barbar'
mysql> SELECT SUBSTRING('Quadratically',5,6);
        -> 'ratica'        
mysql> SELECT SUBSTRING('Sakila', -3);
        -> 'ila'        
mysql> SELECT SUBSTRING('Sakila', -5, 3);
        -> 'aki'
mysql> SELECT SUBSTRING('Sakila' FROM -4 FOR 2);
        -> 'ki'
string-functions20ISEMPTY IsEmpty(g)

Returns 1 if the geometry value g is the empty geometry, 0 if it is not
empty, and -1 if the argument is NULL. If the geometry is empty, it
represents the empty point set.
#general-geometry-property-functions"1LTRIM!RSyntax:
LTRIM(str)

Returns the string str with leading space characters removed.
5mysql> SELECT LTRIM('  barbar');
        -> 'barbar'
string-functions22
INTERSECTSRIntersects(g1,g2)

Returns 1 or 0 to indicate whether g1 spatially intersects g2.
<functions-that-test-spatial-relationships-between-geometries23CALL#Syntax:
CALL sp_name([parameter[,...]])

The CALL statement invokes a procedure that was defined previously with
CREATE PROCEDURE.

CALL can pass back values to its caller using parameters that are
declared as OUT or INOUT parameters. It also "returns" the number of
rows affected, which a client program can obtain at the SQL level by
calling the ROW_COUNT() function and from C by calling the
mysql_affected_rows() C API function.
call24MBRDISJOINTMBRDisjoint(g1,g2)

Returns 1 or 0 to indicate whether the Minimum Bounding Rectangles of
the two geometries g1 and g2 are disjoint (do not intersect).
relations-on-geometry-mbr"5VALUES
0Syntax:
VALUES(col_name)

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()
function is meaningful only in INSERT ... ON DUPLICATE KEY UPDATE
statements and returns NULL otherwise. [insert-on-duplicate].
nmysql> INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)
    -> ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);
miscellaneous-functionsn"6SUBSTRING_INDEX!Syntax:
SUBSTRING_INDEX(str,delim,count)

Returns the substring from string str before count occurrences of the
delimiter delim. If count is positive, everything to the left of the
final delimiter (counting from the left) is returned. If count is
negative, everything to the right of the final delimiter (counting from
the right) is returned. SUBSTRING_INDEX() performs a case-sensitive
match when searching for delim.
mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2);
        -> 'www.mysql'
mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2);
        -> 'mysql.com'
string-functions27ENCODE
Syntax:
ENCODE(str,pass_str)

Encrypt str using pass_str as the password. To decrypt the result, use
DECODE().

The result is a binary string of the same length as str.
encryption-functions28LOOP#Syntax:
[begin_label:] LOOP
    statement_list
END LOOP [end_label]

LOOP implements a simple loop construct, enabling repeated execution of
the statement list, which consists of one or more statements. The
statements within the loop are repeated until the loop is exited;
usually this is accomplished with a LEAVE statement.

A LOOP statement can be labeled. end_label cannot be given unless
begin_label also is present. If both are present, they must be the
same.
loop-statement5"9TRUNCATESyntax:
TRUNCATE(X,D)

Returns the number X, truncated to D decimal places. If D is 0, the
result has no decimal point or fractional part. D can be negative to
cause D digits left of the decimal point of the value X to become zero.
"mysql> SELECT TRUNCATE(1.223,1);
        -> 1.2
mysql> SELECT TRUNCATE(1.999,1);
        -> 1.9
mysql> SELECT TRUNCATE(1.999,0);
        -> 1
mysql> SELECT TRUNCATE(-1.999,1);
        -> -1.9
mysql> SELECT TRUNCATE(122,-2);
       -> 100
mysql> SELECT TRUNCATE(10.28*100,0);
       -> 1028
mathematical-functions":TIMESTAMPADDSyntax:
TIMESTAMPADD(interval,int_expr,datetime_expr)

Adds the integer expression int_expr to the date or datetime expression
datetime_expr. The unit for int_expr is given by the interval argument,
which should be one of the following values: FRAC_SECOND, SECOND,
MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

The interval value may be specified using one of keywords as shown, or
with a prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are
legal.
mysql> SELECT TIMESTAMPADD(MINUTE,1,'2003-01-02');
        -> '2003-01-02 00:01:00'
mysql> SELECT TIMESTAMPADD(WEEK,1,'2003-01-02');
        -> '2003-01-09'
date-and-time-functions#2;SHOWSHOW has many forms that provide information about databases, tables,
columns, or status information about the server. This section describes
those following:

SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [LIKE 'pattern']
SHOW CREATE DATABASE db_name
SHOW CREATE FUNCTION funcname
SHOW CREATE PROCEDURE procname
SHOW CREATE TABLE tbl_name
SHOW DATABASES [LIKE 'pattern']
SHOW ENGINE engine_name {LOGS | STATUS }
SHOW [STORAGE] ENGINES
SHOW ERRORS [LIMIT [offset,] row_count]
SHOW FUNCTION STATUS [LIKE 'pattern']
SHOW GRANTS FOR user
SHOW INDEX FROM tbl_name [FROM db_name]
SHOW INNODB STATUS
SHOW PROCEDURE STATUS [LIKE 'pattern']
SHOW [BDB] LOGS
SHOW PRIVILEGES
SHOW [FULL] PROCESSLIST
SHOW [GLOBAL | SESSION] STATUS [LIKE 'pattern']
SHOW TABLE STATUS [FROM db_name] [LIKE 'pattern']
SHOW [OPEN] TABLES [FROM db_name] [LIKE 'pattern']
SHOW TRIGGERS
SHOW [GLOBAL | SESSION] VARIABLES [LIKE 'pattern']
SHOW WARNINGS [LIMIT [offset,] row_count]

The SHOW statement also has forms that provide information about
replication master and slave servers and are described in
[replication-sql]:

SHOW BINLOG EVENTS
SHOW MASTER LOGS
SHOW MASTER STATUS
SHOW SLAVE HOSTS
SHOW SLAVE STATUS

If the syntax for a given SHOW statement includes a LIKE 'pattern'
part, 'pattern' is a string that can contain the SQL `%' and `_'
wildcard characters. The pattern is useful for restricting statement
output to matching values.

Several SHOW statements also accept a WHERE clause that provides more
flexibility in specifying which rows to display. See [extended-show].
showt"<GREATESTSyntax:
GREATEST(value1,value2,...)

With two or more arguments, returns the largest (maximum-valued)
argument. The arguments are compared using the same rules as for
LEAST().
mysql> SELECT GREATEST(2,0);
        -> 2
mysql> SELECT GREATEST(34.0,3.0,5.0,767.0);
        -> 767.0
mysql> SELECT GREATEST('B','A','C');
        -> 'C'
comparison-operatorsk2=OCTETLENGTH!ESyntax:
OCTET_LENGTH(str)

OCTET_LENGTH() is a synonym for LENGTH().
string-functions2>SHOW VARIABLESSyntax:
SHOW [GLOBAL | SESSION] VARIABLES [LIKE 'pattern']

SHOW VARIABLES shows the values of MySQL system variables. This
information also can be obtained using the mysqladmin variables
command.

With the GLOBAL modifier, SHOW VARIABLES displays the values that are
used for new connections to MySQL. With SESSION, it displays the values
that are in effect for the current connection. If no modifier is
present, the default is SESSION. LOCAL is a synonym for SESSION.
With a LIKE clause, the statement displays only rows for those
variables with names that match the pattern. To obtain the row for a
specific variable, use a LIKE clause as shown:

SHOW VARIABLES LIKE 'max_join_size';
SHOW SESSION VARIABLES LIKE 'max_join_size';

To get a list of variables whose name match a pattern, use the `%'
wildcard character in a LIKE clause:

SHOW VARIABLES LIKE '%size%';
SHOW GLOBAL VARIABLES LIKE '%size%';

Wildcard characters can be used in any position within the pattern to
be matched. Strictly speaking, because `_' is a wildcard that matches
any single character, you should escape it as `\_' to match it
literally. In practice, this is rarely necessary.
show-variables2?BIT_ANDSyntax:
BIT_AND(expr)

Returns the bitwise AND of all bits in expr. The calculation is
performed with 64-bit (BIGINT) precision.
group-by-functions"@SECONDISyntax:
SECOND(time)

Returns the second for time, in the range 0 to 59.
/mysql> SELECT SECOND('10:05:03');
        -> 3
date-and-time-functions}"AATAN2Syntax:
ATAN(Y,X), ATAN2(Y,X)

Returns the arc tangent of the two variables X and Y. It is similar to
calculating the arc tangent of Y / X, except that the signs of both
arguments are used to determine the quadrant of the result.
omysql> SELECT ATAN(-2,2);
        -> -0.78539816339745
mysql> SELECT ATAN2(PI(),0);
        -> 1.5707963267949
mathematical-functionsS"BMBRCONTAINSMBRContains(g1,g2)

Returns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1
contains the Minimum Bounding Rectangle of g2.
mysql> SET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
mysql> SET @g2 = GeomFromText('Point(1 1)');
mysql> SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);
----------------------+----------------------+
| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |
+----------------------+----------------------+
|                    1 |                    0 |
+----------------------+----------------------+
relations-on-geometry-mbr\"CHOURSyntax:
HOUR(time)

Returns the hour for time. The range of the return value is 0 to 23 for
time-of-day values. However, the range of TIME values actually is much
larger, so HOUR can return values greater than 23.
^mysql> SELECT HOUR('10:05:03');
        -> 10
mysql> SELECT HOUR('272:59:59');
        -> 272
date-and-time-functionso2DSELECTXSyntax:
SELECT
    [ALL | DISTINCT | DISTINCTROW ]
      [HIGH_PRIORITY]
      [STRAIGHT_JOIN]
      [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
      [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
    select_expr, ...
    [FROM table_references
    [WHERE where_condition]
    [GROUP BY {col_name | expr | position}
      [ASC | DESC], ... [WITH ROLLUP]]
    [HAVING where_condition]
    [ORDER BY {col_name | expr | position}
      [ASC | DESC], ...]
    [LIMIT {[offset,] row_count | row_count OFFSET offset}]
    [PROCEDURE procedure_name(argument_list)]
    [INTO OUTFILE 'file_name' export_options
      | INTO DUMPFILE 'file_name']
    [FOR UPDATE | LOCK IN SHARE MODE]]

SELECT is used to retrieve rows selected from one or more tables, and
can include UNION statements and subqueries. See [union], and
[subqueries].

The most commonly used clauses of SELECT statements are these:

o Each select_expr indicates a column that you want to retrieve. There
  must be at least one select_expr.

o table_references indicates the table or tables from which to retrieve
  rows. Its syntax is described in [join].

o The WHERE clause, if given, indicates the condition or conditions
  that rows must satisfy to be selected. where_condition is an
  expression that evaluates to true for each row to be selected. The
  statement selects all rows if there is no WHERE clause.

  In the WHERE clause, you can use any of the functions and operators
  that MySQL supports, except for aggregate (summary) functions. See
  [functions].

SELECT can also be used to retrieve rows computed without reference to
any table.
select"ECOT,Syntax:
COT(X)

Returns the cotangent of X.
Ymysql> SELECT COT(12);
        -> -1.5726734063977
mysql> SELECT COT(0);
        -> NULL
mathematical-functions2FBACKUP TABLESyntax:
BACKUP TABLE tbl_name [, tbl_name] ... TO '/path/to/backup/directory'

Note: This statement is deprecated. We are working on a better
replacement for it that will provide online backup capabilities. In the
meantime, the mysqlhotcopy script can be used instead.

BACKUP TABLE copies to the backup directory the minimum number of table
files needed to restore the table, after flushing any buffered changes
to disk. The statement works only for MyISAM tables. It copies the .frm
definition and .MYD data files. The .MYI index file can be rebuilt from
those two files. The directory should be specified as a full pathname.
To restore the table, use RESTORE TABLE.
backup-table"G	LOAD_FILE!PSyntax:
LOAD_FILE(file_name)

Reads the file and returns the file contents as a string. To use this
function, the file must be located on the server host, you must specify
the full pathname to the file, and you must have the FILE privilege.
The file must be readable by all and its size less than
max_allowed_packet bytes.

If the file does not exist or cannot be read because one of the
preceding conditions is not satisfied, the function returns NULL.

As of MySQL 5.0.19, the character_set_filesystem system variable
controls interpretation of filenames that are given as literal strings.
[mysql> UPDATE t
            SET blob_col=LOAD_FILE('/tmp/picture')
            WHERE id=1;
string-functions2H
POINTFROMTEXT[PointFromText(wkt[,srid])

Constructs a POINT value using its WKT representation and SRID.
gis-wkt-functions2ILOAD TABLE FROM MASTERSyntax:
LOAD TABLE tbl_name FROM MASTER

Transfers a copy of the table from the master to the slave. This
statement is implemented mainly debugging LOAD DATA FROM MASTER
operations. To use LOAD TABLE, the account used for connecting to the
master server must have the RELOAD and SUPER privileges on the master
and the SELECT privilege for the master table to load. On the slave
side, the user that issues LOAD TABLE FROM MASTER must have privileges
for dropping and creating the table.

The conditions for LOAD DATA FROM MASTER apply here as well. For
example, LOAD TABLE FROM MASTER works only for MyISAM tables. The
timeout notes for LOAD DATA FROM MASTER apply as well.
load-table-from-master""JGROUP_CONCAT}Syntax:
GROUP_CONCAT(expr)

This function returns a string result with the concatenated non-NULL
values from a group. It returns NULL if there are no non-NULL values.
The full syntax is as follows:

GROUP_CONCAT([DISTINCT] expr [,expr ...]
             [ORDER BY {unsigned_integer | col_name | expr}
                 [ASC | DESC] [,col_name ...]]
             [SEPARATOR str_val])
zmysql> SELECT student_name,
    ->     GROUP_CONCAT(test_score)
    ->     FROM student
    ->     GROUP BY student_name;
group-by-functions"KDATE_FORMATYSyntax:
DATE_FORMAT(date,format)

Formats the date value according to the format string.
Ymysql> SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
        -> 'Saturday October 1997'
mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s');
        -> '22:23:00'
mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',
                          '%D %y %a %d %m %b %j');
        -> '4th 97 Sat 04 10 Oct 277'
mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',
                          '%H %k %I %r %T %S %w');
        -> '22 22 10 10:23:00 PM 22:23:00 00 6'
mysql> SELECT DATE_FORMAT('1999-01-01', '%X %V');
        -> '1998 52'
mysql> SELECT DATE_FORMAT('2006-06-00', '%d');
        -> '00'
date-and-time-functions"L	BENCHMARK%Syntax:
BENCHMARK(count,expr)

The BENCHMARK() function executes the expression expr repeatedly count
times. It may be used to time how quickly MySQL processes the
expression. The result value is always 0. The intended use is from
within the mysql client, which reports query execution times:
Imysql> SELECT BENCHMARK(1000000,ENCODE('hello','goodbye'));
+----------------------------------------------+
| BENCHMARK(1000000,ENCODE('hello','goodbye')) |
+----------------------------------------------+
|                                            0 |
+----------------------------------------------+
1 row in set (4.74 sec)
information-functions"MYEARdSyntax:
YEAR(date)

Returns the year for date, in the range 1000 to 9999, or 0 for the
"zero" date.
0mysql> SELECT YEAR('98-02-03');
        -> 1998
date-and-time-functions2NSHOW ENGINESyntax:
SHOW ENGINE engine_name {LOGS | STATUS }

SHOW ENGINE displays log or status information about a storage engine.
The following statements currently are supported:

SHOW ENGINE BDB LOGS
SHOW ENGINE INNODB STATUS
show-engine&2O
NAME_CONST
Syntax:
NAME_CONST(name,value)

Returns the given value. When used to produce a result set column,
NAME_CONST() causes the column to have the given name.

mysql> SELECT NAME_CONST('myname', 14);
+--------+
| myname |
+--------+
|     14 |
+--------+
miscellaneous-functions2PRELEASE_LOCK
Syntax:
RELEASE_LOCK(str)

Releases the lock named by the string str that was obtained with
GET_LOCK(). Returns 1 if the lock was released, 0 if the lock was not
established by this thread (in which case the lock is not released),
and NULL if the named lock did not exist. The lock does not exist if it
was never obtained by a call to GET_LOCK() or if it has previously been
released.

The DO statement is convenient to use with RELEASE_LOCK(). See [do].
miscellaneous-functions"QIS NULLGSyntax:
IS NULL, IS NOT NULL

Tests whether a value is or is not NULL.
mysql> SELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;
        -> 0, 0, 1
mysql> SELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;
        -> 1, 1, 0
comparison-operators"R
CONVERT_TZ,Syntax:
CONVERT_TZ(dt,from_tz,to_tz)

CONVERT_TZ() converts a datetime value dt from the time zone given by
from_tz to the time zone given by to_tz and returns the resulting
value. Time zones are specified as described in [time-zone-support].
This function returns NULL if the arguments are invalid.
mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
        -> '2004-01-01 13:00:00'
mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00');
        -> '2004-01-01 22:00:00'
date-and-time-functions"STIME_TO_SECLSyntax:
TIME_TO_SEC(time)

Returns the time argument, converted to seconds.
omysql> SELECT TIME_TO_SEC('22:23:00');
        -> 80580
mysql> SELECT TIME_TO_SEC('00:39:38');
        -> 2378
date-and-time-functions"TWEEKDAYeSyntax:
WEEKDAY(date)

Returns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 =
Sunday).
mmysql> SELECT WEEKDAY('1998-02-03 22:23:00');
        -> 1
mysql> SELECT WEEKDAY('1997-11-05');
        -> 2
date-and-time-functions"U
EXPORT_SET!Syntax:
EXPORT_SET(bits,on,off[,separator[,number_of_bits]])

Returns a string such that for every bit set in the value bits, you get
an on string and for every reset bit, you get an off string. Bits in
bits are examined from right to left (from low-order to high-order
bits). Strings are added to the result from left to right, separated by
the separator string (the default being the comma character `,'). The
number of bits examined is given by number_of_bits (defaults to 64).
mysql> SELECT EXPORT_SET(5,'Y','N',',',4);
        -> 'Y,N,Y,N'
mysql> SELECT EXPORT_SET(6,'1','0',',',10);
        -> '0,1,1,0,0,0,0,0,0,0'
string-functions0"V
TIME FUNCTIONoSyntax:
TIME(expr)

Extracts the time part of the time or datetime expression expr and
returns it as a string.
mysql> SELECT TIME('2003-12-31 01:02:03');
        -> '01:02:03'
mysql> SELECT TIME('2003-12-31 01:02:03.000123');
        -> '01:02:03.000123'
date-and-time-functions/"WCAST!Syntax:
CAST(expr AS type), CONVERT(expr,type), CONVERT(expr USING
transcoding_name)

The CAST() and CONVERT() functions take a value of one type and produce
a value of another type.

The type can be one of the following values:

o BINARY[(N)]

o CHAR[(N)]

o DATE

o DATETIME

o DECIMAL

o SIGNED [INTEGER]

o TIME

o UNSIGNED [INTEGER]

BINARY produces a string with the BINARY data type. See
[binary-varbinary] for a description of how this affects comparisons.
If the optional length N is given, BINARY(N) causes the cast to use no
more than N bytes of the argument. As of MySQL 5.0.17, values shorter
than N bytes are padded with 0x00 bytes to a length of N.

CHAR(N) causes the cast to use no more than N characters of the
argument.

The DECIMAL type is available as of MySQL 5.0.8.

CAST() and CONVERT(... USING ...) are standard SQL syntax. The
non-USING form of CONVERT() is ODBC syntax.

CONVERT() with USING is used to convert data between different
character sets. In MySQL, transcoding names are the same as the
corresponding character set names. For example, this statement converts
the string 'abc' in the default character set to the corresponding
string in the utf8 character set:

SELECT CONVERT('abc' USING utf8);
?SELECT enum_col FROM tbl_name ORDER BY CAST(enum_col AS CHAR);
cast-functions|2XSOUNDS LIKE!VSyntax:
expr1 SOUNDS LIKE expr2

This is the same as SOUNDEX(expr1) = SOUNDEX(expr2).
string-functions)"YPERIOD_DIFFSyntax:
PERIOD_DIFF(P1,P2)

Returns the number of months between periods P1 and P2. P1 and P2
should be in the format YYMM or YYYYMM. Note that the period arguments
P1 and P2 are not date values.
6mysql> SELECT PERIOD_DIFF(9802,199703);
        -> 11
date-and-time-functions"ZLIKE!5Syntax:
expr LIKE pat [ESCAPE 'escape_char']

Pattern matching using SQL simple regular expression comparison.
Returns 1 (TRUE) or 0 (FALSE). If either expr or pat is NULL, the
result is NULL.

The pattern need not be a literal string. For example, it can be
specified as a string expression or table column.
emysql> SELECT 'David!' LIKE 'David_';
        -> 1
mysql> SELECT 'David!' LIKE '%D%v%';
        -> 1
string-comparison-functions2[
MULTIPOINTMultiPoint(pt1,pt2,...)

Constructs a WKB MultiPoint value using WKB Point arguments. If any
argument is not a WKB Point, the return value is NULL.
gis-mysql-specific-functions{"\>><Syntax:
>>

Shifts a longlong (BIGINT) number to the right.
#mysql> SELECT 4 >> 2;
        -> 1

bit-functions2]FETCH#Syntax:
FETCH cursor_name INTO var_name [, var_name] ...

This statement fetches the next row (if a row exists) using the
specified open cursor, and advances the cursor pointer.
fetch2^
TRUE FALSEThe constants TRUE and FALSE evaluate to 1 and 0, respectively. The
constant names can be written in any lettercase.

mysql> SELECT TRUE, true, FALSE, false;
        -> 1, 1, 0, 0
boolean-valuesk"_AVGSyntax:
AVG([DISTINCT] expr)

Returns the average value of expr. The DISTINCT option can be used as
of MySQL 5.0.3 to return the average of the distinct values of expr.

AVG() returns NULL if there were no matching rows.
lmysql> SELECT student_name, AVG(test_score)
    ->        FROM student
    ->        GROUP BY student_name;
group-by-functionsM"`	MBRWITHINMBRWithin(g1,g2)

Returns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1
is within the Minimum Bounding Rectangle of g2.
mysql> SET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
mysql> SET @g2 = GeomFromText('Polygon((0 0,0 5,5 5,5 0,0 0))');
mysql> SELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);
+--------------------+--------------------+
| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |
+--------------------+--------------------+
|                  1 |                  0 |
+--------------------+--------------------+
relations-on-geometry-mbr_"aINSyntax:
expr IN (value,...)

Returns 1 if expr is equal to any of the values in the IN list, else
returns 0. If all values are constants, they are evaluated according to
the type of expr and sorted. The search for the item then is done using
a binary search. This means IN is very quick if the IN value list
consists entirely of constants. Otherwise, type conversion takes place
according to the rules described in [type-conversion], but applied to
all the arguments.
hmysql> SELECT 2 IN (0,3,5,'wefwf');
        -> 0
mysql> SELECT 'wefwf' IN (0,3,5,'wefwf');
        -> 1
comparison-operators"bQUOTE!Syntax:
QUOTE(str)

Quotes a string to produce a result that can be used as a properly
escaped data value in an SQL statement. The string is returned enclosed
by single quotes and with each instance of single quote (`''),
backslash (`\'), ASCII NUL, and Control-Z preceded by a backslash. If
the argument is NULL, the return value is the word "NULL" without
enclosing single quotes.
`mysql> SELECT QUOTE('Don\'t!');
        -> 'Don\'t!'
mysql> SELECT QUOTE(NULL);
        -> NULL
string-functionsl2cSESSION_USER@Syntax:
SESSION_USER()

SESSION_USER() is a synonym for USER().
information-functions"dQUARTERVSyntax:
QUARTER(date)

Returns the quarter of the year for date, in the range 1 to 4.
0mysql> SELECT QUARTER('98-04-01');
        -> 2
date-and-time-functions2ePOSITION!^Syntax:
POSITION(substr IN str)

POSITION(substr IN str) is a synonym for LOCATE(substr,str).
string-functions2fIS_USED_LOCK
Syntax:
IS_USED_LOCK(str)

Checks whether the lock named str is in use (that is, locked). If so,
it returns the connection identifier of the client that holds the lock.
Otherwise, it returns NULL.
miscellaneous-functions2gPOLYFROMTEXTyPolyFromText(wkt[,srid]), PolygonFromText(wkt[,srid])

Constructs a POLYGON value using its WKT representation and SRID.
gis-wkt-functions"hDES_ENCRYPT
uSyntax:
DES_ENCRYPT(str[,{key_num|key_str}])

Encrypts the string with the given key using the Triple-DES algorithm.
key_num des_key_str
encryption-functionsE"iLENGTH!Syntax:
LENGTH(str)

Returns the length of the string str, measured in bytes. A multi-byte
character counts as multiple bytes. This means that for a string
containing five two-byte characters, LENGTH() returns 10, whereas
CHAR_LENGTH() returns 5.
+mysql> SELECT LENGTH('text');
        -> 4
string-functions2jSTR_TO_DATESyntax:
STR_TO_DATE(str,format)

This is the inverse of the DATE_FORMAT() function. It takes a string
str and a format string format. STR_TO_DATE() returns a DATETIME value
if the format string contains both date and time parts, or a DATE or
TIME value if the string contains only date or time parts.

The date, time, or datetime values contained in str should be given in
the format indicated by format. For the specifiers that can be used in
format, see the DATE_FORMAT() function description. If str contains an
illegal date, time, or datetime value, STR_TO_DATE() returns NULL.
Starting from MySQL 5.0.3, an illegal value also produces a warning.
date-and-time-functions@"kY	SY(p)

Returns the Y-coordinate value for the point p as a double-precision
number.
mysql> SET @pt = 'Point(56.7 53.34)';
mysql> SELECT Y(GeomFromText(@pt));
+----------------------+
| Y(GeomFromText(@pt)) |
+----------------------+
|                53.34 |
+----------------------+
point-property-functions2lSHOW INNODB STATUSySyntax:
SHOW INNODB STATUS

In MySQL 5.0, this is a deprecated synonym for SHOW ENGINE INNODB
STATUS. See [show-engine].
show-innodb-status2mCHECKSUM TABLESyntax:
CHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]

CHECKSUM TABLE reports a table checksum.

With QUICK, the live table checksum is reported if it is available, or
NULL otherwise. This is very fast. A live checksum is enabled by
specifying the CHECKSUM=1 table option when you create the table;
currently, this is supported only for MyISAM tables. See
[create-table].

With EXTENDED, the entire table is read row by row and the checksum is
calculated. This can be very slow for large tables.

If neither QUICK nor EXTENDED is specified, MySQL returns a live
checksum if the table storage engine supports it and scans the table
otherwise.

For a non-existent table, CHECKSUM TABLE returns NULL and, as of MySQL
5.0.3, generates a warning.
checksum-table"nNUMINTERIORRINGSXNumInteriorRings(poly)

Returns the number of interior rings in the Polygon value poly.
Ymysql> SET @poly =
    -> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
mysql> SELECT NumInteriorRings(GeomFromText(@poly));
+---------------------------------------+
| NumInteriorRings(GeomFromText(@poly)) |
+---------------------------------------+
|                                     1 |
+---------------------------------------+
polygon-property-functions>"o
INTERIORRINGNInteriorRingN(poly,N)

Returns the N-th interior ring for the Polygon value poly as a
LineString. Rings are numbered beginning with 1.
mysql> SET @poly =
    -> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
mysql> SELECT AsText(InteriorRingN(GeomFromText(@poly),1));
+----------------------------------------------+
| AsText(InteriorRingN(GeomFromText(@poly),1)) |
+----------------------------------------------+
| LINESTRING(1 1,1 2,2 2,2 1,1 1)              |
+----------------------------------------------+
polygon-property-functions$"pUTC_TIMESyntax:
UTC_TIME, UTC_TIME()

Returns the current UTC time as a value in 'HH:MM:SS' or HHMMSS format,
depending on whether the function is used in a string or numeric
context.
Hmysql> SELECT UTC_TIME(), UTC_TIME() + 0;
        -> '18:07:53', 180753
date-and-time-functionsr2q
DROP FUNCTION"MSyntax:
DROP FUNCTION function_name

This statement drops the user-defined function (UDF) named
function_name.

To drop a function, you must have the DELETE privilege for the mysql
database. This is because DROP FUNCTION removes a row from the
mysql.func system table that records the function's name, type, and
shared library name.

drop-functionv2rSTDDEVSSyntax:
STD(expr) STDDEV(expr)

Returns the population standard deviation of expr. This is an extension
to standard SQL. The STDDEV() form of this function is provided for
compatibility with Oracle. As of MySQL 5.0.3, the standard SQL function
STDDEV_POP() can be used instead.

These functions return NULL if there were no matching rows.
group-by-functions"s
PERIOD_ADDSyntax:
PERIOD_ADD(P,N)

Adds N months to period P (in the format YYMM or YYYYMM). Returns a
value in the format YYYYMM. Note that the period argument P is not a
date value.
4mysql> SELECT PERIOD_ADD(9801,2);
        -> 199803
date-and-time-functionsW"t|Syntax:
|

Bitwise OR:
%mysql> SELECT 29 | 15;
        -> 31

bit-functions2uGEOMFROMTEXTGeomFromText(wkt[,srid]), GeometryFromText(wkt[,srid])

Constructs a geometry value of any type using its WKT representation
and SRID.
gis-wkt-functions"vRIGHT!RSyntax:
RIGHT(str,len)

Returns the rightmost len characters from the string str.
7mysql> SELECT RIGHT('foobarbar', 4);
        -> 'rbar'
string-functions"wDATEDIFFSyntax:
DATEDIFF(expr,expr2)

DATEDIFF() returns the number of days between the start date expr and
the end date expr2. expr and expr2 are date or date-and-time
expressions. Only the date parts of the values are used in the
calculation.
mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
        -> 1
mysql> SELECT DATEDIFF('1997-11-30 23:59:59','1997-12-31');
        -> -31
date-and-time-functions$2xDROP PROCEDURE#Syntax:
DROP {PROCEDURE | FUNCTION} [IF EXISTS] sp_name

This statement is used to drop a stored procedure or function. That is,
the specified routine is removed from the server. As of MySQL 5.0.3,
you must have the ALTER ROUTINE privilege for the routine. (That
privilege is granted automatically to the routine creator.)

The IF EXISTS clause is a MySQL extension. It prevents an error from
occurring if the procedure or function does not exist. A warning is
produced that can be viewed with SHOW WARNINGS.
drop-procedure2yCHECK TABLESyntax:
CHECK TABLE tbl_name [, tbl_name] ... [option] ...

option = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}

CHECK TABLE checks a table or tables for errors. CHECK TABLE works for
MyISAM, InnoDB, and (as of MySQL 5.0.16) ARCHIVE tables. For MyISAM
tables, the key statistics are updated as well.

As of MySQL 5.0.2, CHECK TABLE can also check views for problems, such
as tables that are referenced in the view definition that no longer
exist.
check-table"zBIN!Syntax:
BIN(N)

Returns a string representation of the binary value of N, where N is a
longlong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns
NULL if N is NULL.
)mysql> SELECT BIN(12);
        -> '1100'
string-functions"{
CASE FUNCTIONSyntax:
CASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN
result ...] [ELSE result] END

CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...]
[ELSE result] END

The first version returns the result where value=compare_value. The
second version returns the result for the first condition that is true.
If there was no matching result value, the result after ELSE is
returned, or NULL if there is no ELSE part.
mysql> SELECT CASE 1 WHEN 1 THEN 'one'
    ->     WHEN 2 THEN 'two' ELSE 'more' END;
        -> 'one'
mysql> SELECT CASE WHEN 1>0 THEN 'true' ELSE 'false' END;
        -> 'true'
mysql> SELECT CASE BINARY 'B'
    ->     WHEN 'a' THEN 1 WHEN 'b' THEN 2 END;
        -> NULL
control-flow-functions2|DECLARE CURSOR#Syntax:
DECLARE cursor_name CURSOR FOR select_statement

This statement declares a cursor. Multiple cursors may be declared in a
routine, but each cursor in a given block must have a unique name.

The SELECT statement cannot have an INTO clause.
declare-cursors2}MULTILINESTRINGMultiLineString(ls1,ls2,...)

Constructs a WKB MultiLineString value using WKB LineString arguments.
If any argument is not a WKB LineString, the return value is NULL.
gis-mysql-specific-functionsc2~	LOAD DATAFSyntax:
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name'
    [REPLACE | IGNORE]
    INTO TABLE tbl_name
    [FIELDS
        [TERMINATED BY 'string']
        [[OPTIONALLY] ENCLOSED BY 'char']
        [ESCAPED BY 'char']
    ]
    [LINES
        [STARTING BY 'string']
        [TERMINATED BY 'string']
    ]
    [IGNORE number LINES]
    [(col_name_or_user_var,...)]
    [SET col_name = expr,...)]

The LOAD DATA INFILE statement reads rows from a text file into a table
at a very high speed. The filename must be given as a literal string.

LOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See
[select].) To write data from a table to a file, use SELECT ... INTO
OUTFILE. To read the file back into a table, use LOAD DATA INFILE. The
syntax of the FIELDS and LINES clauses is the same for both statements.
Both clauses are optional, but FIELDS must precede LINES if both are
specified.

For more information about the efficiency of INSERT versus LOAD DATA
INFILE and speeding up LOAD DATA INFILE, see [insert-speed].

The character set indicated by the character_set_database system
variable is used to interpret the information in the file. SET NAMES
and the setting of character_set_client do not affect interpretation of
input.

Note that it is currently not possible to load data files that use the
ucs2 character set.

As of MySQL 5.0.19, the character_set_filesystem system variable
controls the interpretation of the filename.

You can also load data files by using the mysqlimport utility; it
operates by sending a LOAD DATA INFILE statement to the server. The
--local option causes mysqlimport to read data files from the client
host. You can specify the --compress option to get better performance
over slow networks if the client and server support the compressed
protocol. See [mysqlimport].

If you use LOW_PRIORITY, execution of the LOAD DATA statement is
delayed until no other clients are reading from the table.

If you specify CONCURRENT with a MyISAM table that satisfies the
condition for concurrent inserts (that is, it contains no free blocks
in the middle), other threads can retrieve data from the table while
LOAD DATA is executing. Using this option affects the performance of
LOAD DATA a bit, even if no other thread is using the table at the same
time.

The LOCAL keyword, if specified, is interpreted with respect to the
client end of the connection:

o If LOCAL is specified, the file is read by the client program on the
  client host and sent to the server. The file can be given as a full
  pathname to specify its exact location. If given as a relative
  pathname, the name is interpreted relative to the directory in which
  the client program was started.

o If LOCAL is not specified, the file must be located on the server
  host and is read directly by the server. The server uses the
  following rules to locate the file:

  o If the filename is an absolute pathname, the server uses it as
    given.

  o If the filename is a relative pathname with one or more leading
    components, the server searches for the file relative to the
    server's data directory.

  o If a filename with no leading components is given, the server looks
    for the file in the database directory of the default database.

Note that, in the non-LOCAL case, these rules mean that a file named as
./myfile.txt is read from the server's data directory, whereas the file
named as myfile.txt is read from the database directory of the default
database. For example, if db1 is the default database, the following
LOAD DATA statement reads the file data.txt from the database directory
for db1, even though the statement explicitly loads the file into a
table in the db2 database:

LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;

Windows pathnames are specified using forward slashes rather than
backslashes. If you do use backslashes, you must double them.

For security reasons, when reading text files located on the server,
the files must either reside in the database directory or be readable
by all. Also, to use LOAD DATA INFILE on server files, you must have
the FILE privilege. See [privileges-provided].
	load-data}2	LOCALTIMERSyntax:
LOCALTIME, LOCALTIME()

LOCALTIME and LOCALTIME() are synonyms for NOW().
date-and-time-functions2MPOINTFROMTEXTMPointFromText(wkt[,srid]), MultiPointFromText(wkt[,srid])

Constructs a MULTIPOINT value using its WKT representation and SRID.
gis-wkt-functions
2BLOBBLOB[(M)]

A BLOB column with a maximum length of 65,535 (216 - 1) bytes.

An optional length M can be given for this type. If this is done, MySQL
creates the column as the smallest BLOB type large enough to hold
values M bytes long.
string-type-overview"PASSWORD
Syntax:
PASSWORD(str)

Calculates and returns a password string from the plaintext password
str and returns a binary string, or NULL if the argument was NULL. This
is the function that is used for encrypting MySQL passwords for storage
in the Password column of the user grant table.
Ymysql> SELECT PASSWORD('badpwd');
        -> '*AAB3E285149C0135D51A520E1940DD3263DC008C'
encryption-functionsI2CHAR&[NATIONAL] CHAR(M)

A fixed-length string that is always right-padded with spaces to the
specified length when stored. M represents the column length. The range
of M is 0 to 255 characters.

Note: Trailing spaces are removed when CHAR values are retrieved.

Before MySQL 5.0.3, a CHAR column with a length specification greater
than 255 is converted to the smallest TEXT type that can hold values of
the given length. For example, CHAR(500) is converted to TEXT, and
CHAR(200000) is converted to MEDIUMTEXT. This is a compatibility
feature. However, this conversion causes the column to become a
variable-length column, and also affects trailing-space removal.

In MySQL 5.0.3 and later, if you attempt to set the length of a CHAR
greater than 255, the CREATE TABLE or ALTER TABLE statement in which
this is done fails with an error:

mysql> CREATE TABLE c1 (col1 INT, col2 CHAR(500));
ERROR 1074 (42000): Column length too big for column 'col' (max = 255);
use BLOB or TEXT instead
mysql> SHOW CREATE TABLE c1;
ERROR 1146 (42S02): Table 'test.c1' doesn't exist
string-type-overview,"UTC_DATESyntax:
UTC_DATE, UTC_DATE()

Returns the current UTC date as a value in 'YYYY-MM-DD' or YYYYMMDD
format, depending on whether the function is used in a string or
numeric context.
Lmysql> SELECT UTC_DATE(), UTC_DATE() + 0;
        -> '2003-08-14', 20030814
date-and-time-functions"	DIMENSION Dimension(g)

Returns the inherent dimension of the geometry value g. The result can
be -1, 0, 1, or 2. The meaning of these values is given in
[gis-class-geometry].
=mysql> SELECT Dimension(GeomFromText('LineString(1 1,2 2)'));
+------------------------------------------------+
| Dimension(GeomFromText('LineString(1 1,2 2)')) |
+------------------------------------------------+
|                                              1 |
+------------------------------------------------+
#general-geometry-property-functions"COUNT DISTINCTSyntax:
COUNT(DISTINCT expr,[expr...])

Returns a count of the number of different non-NULL values.

COUNT(DISTINCT) returns 0 if there were no matching rows.
4mysql> SELECT COUNT(DISTINCT results) FROM student;
group-by-functions/2BITBIT[(M)]

A bit-field type. M indicates the number of bits per value, from 1 to
64. The default is 1 if M is omitted.

This data type was added in MySQL 5.0.3 for MyISAM, and extended in
5.0.5 to MEMORY, InnoDB, and BDB. Before 5.0.3, BIT is a synonym for
TINYINT(1).
numeric-type-overview2EQUALSOEquals(g1,g2)

Returns 1 or 0 to indicate whether g1 is spatially equal to g2.
<functions-that-test-spatial-relationships-between-geometries2SHOW CREATE VIEWnSyntax:
SHOW CREATE VIEW view_name

This statement shows a CREATE VIEW statement that creates the given
view.
show-create-view"INTERVALSyntax:
INTERVAL(N,N1,N2,N3,...)

Returns 0 if N < N1, 1 if N < N2 and so on or -1 if N is NULL. All
arguments are treated as integers. It is required that N1 < N2 < N3 <
... < Nn for this function to work correctly. This is because a binary
search is used (very fast).
mysql> SELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);
        -> 3
mysql> SELECT INTERVAL(10, 1, 10, 100, 1000);
        -> 2
mysql> SELECT INTERVAL(22, 23, 30, 44, 200);
        -> 0
comparison-operators"	FROM_DAYSBSyntax:
FROM_DAYS(N)

Given a day number N, returns a DATE value.
9mysql> SELECT FROM_DAYS(729669);
        -> '1997-10-07'
date-and-time-functions2ALTER PROCEDURE#Syntax:
ALTER {PROCEDURE | FUNCTION} sp_name [characteristic ...]

characteristic:
    { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
  | SQL SECURITY { DEFINER | INVOKER }
  | COMMENT 'string'

This statement can be used to change the characteristics of a stored
procedure or function. As of MySQL 5.0.3, you must have the ALTER
ROUTINE privilege for the routine. (That privilege is granted
automatically to the routine creator.) If binary logging is enabled,
this statement might also require the SUPER privilege, as described in
[stored-procedure-logging].

More than one change may be specified in an ALTER PROCEDURE or ALTER
FUNCTION statement.
alter-procedure"	BIT_COUNTQSyntax:
BIT_COUNT(N)

Returns the number of bits that are set in the argument N.
Cmysql> SELECT BIT_COUNT(29), BIT_COUNT(b'101010');
        -> 4, 3

bit-functionsl"
UTC_TIMESTAMPSyntax:
UTC_TIMESTAMP, UTC_TIMESTAMP()

Returns the current UTC date and time as a value in 'YYYY-MM-DD
HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function
is used in a string or numeric context.
emysql> SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;
        -> '2003-08-14 18:08:04', 20030814180804
date-and-time-functionsW"+Syntax:
+

Addition:
 mysql> SELECT 3+5;
        -> 8
arithmetic-functions"	INET_NTOA
Syntax:
INET_NTOA(expr)

Given a numeric network address (4 or 8 byte), returns the dotted-quad
representation of the address as a string.
Amysql> SELECT INET_NTOA(3520061480);
        -> '209.207.224.40'
miscellaneous-functions,"ACOSSyntax:
ACOS(X)

Returns the arc cosine of X, that is, the value whose cosine is X.
Returns NULL if X is not in the range -1 to 1.
mysql> SELECT ACOS(1);
        -> 0
mysql> SELECT ACOS(1.0001);
        -> NULL
mysql> SELECT ACOS(0);
        -> 1.5707963267949
mathematical-functions2	ISOLATIONSyntax:
SET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL
{ READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE }

This statement sets the transaction isolation level for the next
transaction, globally, or for the current session.

The default behavior of SET TRANSACTION is to set the isolation level
for the next (not yet started) transaction. If you use the GLOBAL
keyword, the statement sets the default transaction level globally for
all new connections created from that point on. Existing connections
are unaffected. You need the SUPER privilege to do this. Using the
SESSION keyword sets the default transaction level for all future
transactions performed on the current connection.

For descriptions of each InnoDB transaction isolation level, see
[innodb-transaction-isolation]. InnoDB supports each of these levels in
MySQL 5.0. The default level is REPEATABLE READ.

To set the initial default global isolation level for mysqld, use the
--transaction-isolation option. See [server-options].
set-transaction"CEILINGQSyntax:
CEILING(X), CEIL(X)

Returns the smallest integer value not less than X.
Smysql> SELECT CEILING(1.23);
        -> 2
mysql> SELECT CEIL(-1.23);
        -> -1
mathematical-functions"SINDSyntax:
SIN(X)

Returns the sine of X, where X is given in radians.
emysql> SELECT SIN(PI());
        -> 1.2246063538224e-16
mysql> SELECT ROUND(SIN(PI()));
        -> 0
mathematical-functions"	DAYOFWEEKSyntax:
DAYOFWEEK(date)

Returns the weekday index for date (1 = Sunday, 2 = Monday, ..., 7 =
Saturday). These index values correspond to the ODBC standard.
4mysql> SELECT DAYOFWEEK('1998-02-03');
        -> 3
date-and-time-functions2LINEFROMWKB}LineFromWKB(wkb[,srid]), LineStringFromWKB(wkb[,srid])

Constructs a LINESTRING value using its WKB representation and SRID.
gis-wkb-functions2SHOW PROCESSLISTSyntax:
SHOW [FULL] PROCESSLIST

SHOW PROCESSLIST shows you which threads are running. You can also get
this information using the mysqladmin processlist command. If you have
the SUPER privilege, you can see all threads. Otherwise, you can see
only your own threads (that is, threads associated with the MySQL
account that you are using). See [kill]. If you do not use the FULL
keyword, only the first 100 characters of each statement are shown in
the Info field.
show-processlist"GEOMETRYTYPE GeometryType(g)

Returns as a string the name of the geometry type of which the geometry
instance g is a member. The name corresponds to one of the instantiable
Geometry subclasses.
mysql> SELECT GeometryType(GeomFromText('POINT(1 1)'));
+------------------------------------------+
| GeometryType(GeomFromText('POINT(1 1)')) |
+------------------------------------------+
| POINT                                    |
+------------------------------------------+
#general-geometry-property-functions<2CREATE VIEW$<Syntax:
CREATE
    [OR REPLACE]
    [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
    [DEFINER = { user | CURRENT_USER }]
    [SQL SECURITY { DEFINER | INVOKER }]
    VIEW view_name [(column_list)]
    AS select_statement
    [WITH [CASCADED | LOCAL] CHECK OPTION]

This statement creates a new view, or replaces an existing one if the
OR REPLACE clause is given. The select_statement is a SELECT statement
that provides the definition of the view. The statement can select from
base tables or other views.

This statement requires the CREATE VIEW privilege for the view, and
some privilege for each column selected by the SELECT statement. For
columns used elsewhere in the SELECT statement you must have the SELECT
privilege. If the OR REPLACE clause is present, you must also have the
DROP privilege for the view.

A view belongs to a database. By default, a new view is created in the
default database. To create the view explicitly in a given database,
specify the name as db_name.view_name when you create it.

mysql> CREATE VIEW test.v AS SELECT * FROM t;

Base tables and views share the same namespace within a database, so a
database cannot contain a base table and a view that have the same
name.

Views must have unique column names with no duplicates, just like base
tables. By default, the names of the columns retrieved by the SELECT
statement are used for the view column names. To define explicit names
for the view columns, the optional column_list clause can be given as a
list of comma-separated identifiers. The number of names in column_list
must be the same as the number of columns retrieved by the SELECT
statement.

Columns retrieved by the SELECT statement can be simple references to
table columns. They can also be expressions that use functions,
constant values, operators, and so forth.

Unqualified table or view names in the SELECT statement are interpreted
with respect to the default database. A view can refer to tables or
views in other databases by qualifying the table or view name with the
proper database name.

A view can be created from many kinds of SELECT statements. It can
refer to base tables or other views. It can use joins, UNION, and
subqueries. The SELECT need not even refer to any tables. The following
example defines a view that selects two columns from another table, as
well as an expression calculated from those columns:

mysql> CREATE TABLE t (qty INT, price INT);
mysql> INSERT INTO t VALUES(3, 50);
mysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;
mysql> SELECT * FROM v;
+------+-------+-------+
| qty  | price | value |
+------+-------+-------+
|    3 |    50 |   150 |
+------+-------+-------+

A view definition is subject to the following restrictions:

o The SELECT statement cannot contain a subquery in the FROM clause.

o The SELECT statement cannot refer to system or user variables.

o The SELECT statement cannot refer to prepared statement parameters.

o Within a stored routine, the definition cannot refer to routine
  parameters or local variables.

o Any table or view referred to in the definition must exist. However,
  after a view has been created, it is possible to drop a table or view
  that the definition refers to. To check a view definition for
  problems of this kind, use the CHECK TABLE statement.

o The definition cannot refer to a TEMPORARY table, and you cannot
  create a TEMPORARY view.

o The tables named in the view definition must already exist.

o You cannot associate a trigger with a view.

ORDER BY is allowed in a view definition, but it is ignored if you
select from a view using a statement that has its own ORDER BY.

For other options or clauses in the definition, they are added to the
options or clauses of the statement that references the view, but the
effect is undefined. For example, if a view definition includes a LIMIT
clause, and you select from the view using a statement that has its own
LIMIT clause, it is undefined which limit applies. This same principle
applies to options such as ALL, DISTINCT, or SQL_SMALL_RESULT that
follow the SELECT keyword, and to clauses such as INTO, FOR UPDATE,
LOCK IN SHARE MODE, and PROCEDURE.

If you create a view and then change the query processing environment
by changing system variables, that may affect the results that you get
from the view:

mysql> CREATE VIEW v AS SELECT CHARSET(CHAR(65)), COLLATION(CHAR(65));
Query OK, 0 rows affected (0.00 sec)

mysql> SET NAMES 'latin1';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM v;
+-------------------+---------------------+
| CHARSET(CHAR(65)) | COLLATION(CHAR(65)) |
+-------------------+---------------------+
| latin1            | latin1_swedish_ci   |
+-------------------+---------------------+
1 row in set (0.00 sec)

mysql> SET NAMES 'utf8';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM v;
+-------------------+---------------------+
| CHARSET(CHAR(65)) | COLLATION(CHAR(65)) |
+-------------------+---------------------+
| utf8              | utf8_general_ci     |
+-------------------+---------------------+
1 row in set (0.00 sec)

The DEFINER and SQL SECURITY clauses specify the security context to be
used when checking access privileges at view invocation time. They were
addded in MySQL 5.0.13, but have no effect until MySQL 5.0.16.

CURRENT_USER also can be given as CURRENT_USER().

Within a stored routine that is defined with the SQL SECURITY DEFINER
characteristic, CURRENT_USER returns the routine creator. This also
affects a view defined within such a routine, if the view definition
contains a DEFINER value of CURRENT_USER.

The default DEFINER value is the user who executes the CREATE VIEW
statement. (This is the same as DEFINER = CURRENT_USER.) If a user
value is given, it should be a MySQL account in 'user_name'@'host_name'
format (the same format used in the GRANT statement). The user_name and
host_name values both are required.

If you specify the DEFINER clause, you cannot set the value to any user
but your own unless you have the SUPER privilege. These rules determine
the legal DEFINER user values:

o If you do not have the SUPER privilege, the only legal user value is
  your own account, either specified literally or by using
  CURRENT_USER. You cannot set the definer to some other account.

o If you have the SUPER privilege, you can specify any syntactically
  legal account name. If the account does not actually exist, a warning
  is generated.

The SQL SECURITY characteristic determines which MySQL account to use
when checking access privileges for the view when the view is executed.
The legal characteristic values are DEFINER and INVOKER. These indicate
that the view must be executable by the user who defined it or invoked
it, respectively. The default SQL SECURITY value is DEFINER.

As of MySQL 5.0.16 (when the DEFINER and SQL SECURITY clauses were
implemented), view privileges are checked like this:

o At view definition time, the view creator must have the privileges
  needed to use the top-level objects accessed by the view. For
  example, if the view definition refers to a stored function, only the
  privileges needed to invoke the function can be checked. The
  privileges required when the function runs can be checked only as it
  executes: For different invocations of the function, different
  execution paths within the function might be taken.

o At view execution time, privileges for objects accessed by the view
  are checked against the privileges held by the view creator or
  invoker, depending on whether the SQL SECURITY characteristic is
  DEFINER or INVOKER, respectively.

o If view execution causes execution of a stored function, privilege
  checking for statements executed within the function depend on
  whether the function is defined with a SQL SECURITY characteristic of
  DEFINER or INVOKER. If the security characteristic is DEFINER, the
  function runs with the privileges of its creator. If the
  characteristic is INVOKER, the function runs with the privileges
  determined by the view's SQL SECURITY characteristic.

Prior to MySQL 5.0.16 (before the DEFINER and SQL SECURITY clauses were
implemented), privileges required for objects used in a view are
checked at view creation time.

Example: A view might depend on a stored function, and that function
might invoke other stored routines. For example, the following view
invokes a stored function f():

CREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);

Suppose that f() contains a statement such as this:

IF name IS NULL then
  CALL p1();
ELSE
  CALL p2();
END IF;

The privileges required for executing statements within f() need to be
checked when f() executes. This might mean that privileges are needed
for p1() or p2(), depending on the execution path within f(). Those
privileges need to be checked at runtime, and the user who must possess
the privileges is determined by the SQL SECURITY values of the function
f() and the view v.

The DEFINER and SQL SECURITY clauses for views are extensions to
standard SQL. In standard SQL, views are handled using the rules for
SQL SECURITY INVOKER.

If you invoke a view that was created before MySQL 5.0.13, it is
treated as though it was created with a SQL SECURITY DEFINER clause and
with a DEFINER value that is the same as your account. However, because
the actual definer is unknown, MySQL issues a warning. To make the
warning go away, it is sufficient to re-create the view so that the
view definition includes a DEFINER clause.

The optional ALGORITHM clause is a MySQL extension to standard SQL.
ALGORITHM takes three values: MERGE, TEMPTABLE, or UNDEFINED. The
default algorithm is UNDEFINED if no ALGORITHM clause is present. The
algorithm affects how MySQL processes the view.

For MERGE, the text of a statement that refers to the view and the view
definition are merged such that parts of the view definition replace
corresponding parts of the statement.

For TEMPTABLE, the results from the view are retrieved into a temporary
table, which then is used to execute the statement.

For UNDEFINED, MySQL chooses which algorithm to use. It prefers MERGE
over TEMPTABLE if possible, because MERGE is usually more efficient and
because a view cannot be updatable if a temporary table is used.

A reason to choose TEMPTABLE explicitly is that locks can be released
on underlying tables after the temporary table has been created and
before it is used to finish processing the statement. This might result
in quicker lock release than the MERGE algorithm so that other clients
that use the view are not blocked as long.

A view algorithm can be UNDEFINED for three reasons:

o No ALGORITHM clause is present in the CREATE VIEW statement.

o The CREATE VIEW statement has an explicit ALGORITHM = UNDEFINED
  clause.

o ALGORITHM = MERGE is specified for a view that can be processed only
  with a temporary table. In this case, MySQL generates a warning and
  sets the algorithm to UNDEFINED.

As mentioned earlier, MERGE is handled by merging corresponding parts
of a view definition into the statement that refers to the view. The
following examples briefly illustrate how the MERGE algorithm works.
The examples assume that there is a view v_merge that has this
definition:

CREATE ALGORITHM = MERGE VIEW v_merge (vc1, vc2) AS
SELECT c1, c2 FROM t WHERE c3 > 100;

Example 1: Suppose that we issue this statement:

SELECT * FROM v_merge;

MySQL handles the statement as follows:

o v_merge becomes t

o * becomes vc1, vc2, which corresponds to c1, c2

o The view WHERE clause is added

The resulting statement to be executed becomes:

SELECT c1, c2 FROM t WHERE c3 > 100;

Example 2: Suppose that we issue this statement:

SELECT * FROM v_merge WHERE vc1 < 100;

This statement is handled similarly to the previous one, except that
vc1 < 100 becomes c1 < 100 and the view WHERE clause is added to the
statement WHERE clause using an AND connective (and parentheses are
added to make sure the parts of the clause are executed with correct
precedence). The resulting statement to be executed becomes:

SELECT c1, c2 FROM t WHERE (c3 > 100) AND (c1 < 100);

Effectively, the statement to be executed has a WHERE clause of this
form:

WHERE (select WHERE) AND (view WHERE)

The MERGE algorithm requires a one-to-one relationship between the rows
in the view and the rows in the underlying table. If this relationship
does not hold, a temporary table must be used instead. Lack of a
one-to-one relationship occurs if the view contains any of a number of
constructs:

o Aggregate functions (SUM(), MIN(), MAX(), COUNT(), and so forth)

o DISTINCT

o GROUP BY

o HAVING

o UNION or UNION ALL

o Refers only to literal values (in this case, there is no underlying
  table)

Some views are updatable. That is, you can use them in statements such
as UPDATE, DELETE, or INSERT to update the contents of the underlying
table. For a view to be updatable, there must be a one-to-one
relationship between the rows in the view and the rows in the
underlying table. There are also certain other constructs that make a
view non-updatable. To be more specific, a view is not updatable if it
contains any of the following:

o Aggregate functions (SUM(), MIN(), MAX(), COUNT(), and so forth)

o DISTINCT

o GROUP BY

o HAVING

o UNION or UNION ALL

o Subquery in the select list

o Join

o Non-updatable view in the FROM clause

o A subquery in the WHERE clause that refers to a table in the FROM
  clause

o Refers only to literal values (in this case, there is no underlying
  table to update)

o ALGORITHM = TEMPTABLE (use of a temporary table always makes a view
  non-updatable)

With respect to insertability (being updatable with INSERT statements),
an updatable view is insertable if it also satisfies these additional
requirements for the view columns:

o There must be no duplicate view column names.

o The view must contain all columns in the base table that do not have
  a default value.

o The view columns must be simple column references and not derived
  columns. A derived column is one that is not a simple column
  reference but is derived from an expression. These are examples of
  derived columns:

3.14159
col1 + 3
UPPER(col2)
col3 / col4
(subquery)

A view that has a mix of simple column references and derived columns
is not insertable, but it can be updatable if you update only those
columns that are not derived. Consider this view:

CREATE VIEW v AS SELECT col1, 1 AS col2 FROM t;

This view is not insertable because col2 is derived from an expression.
But it is updatable if the update does not try to update col2. This
update is allowable:

UPDATE v SET col1 = 0;

This update is not allowable because it attempts to update a derived
column:

UPDATE v SET col2 = 0;

It is sometimes possible for a multiple-table view to be updatable,
assuming that it can be processed with the MERGE algorithm. For this to
work, the view must use an inner join (not an outer join or a UNION).
Also, only a single table in the view definition can be updated, so the
SET clause must name only columns from one of the tables in the view.
Views that use UNION ALL are disallowed even though they might be
theoretically updatable, because the implementation uses temporary
tables to process them.

For a multiple-table updatable view, INSERT can work if it inserts into
a single table. DELETE is not supported.

The WITH CHECK OPTION clause can be given for an updatable view to
prevent inserts or updates to rows except those for which the WHERE
clause in the select_statement is true.
create-viewH"TRIM!+Syntax:
TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr
FROM] str)

Returns the string str with all remstr prefixes or suffixes removed. If
none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is
assumed. remstr is optional and, if not specified, spaces are removed.
mysql> SELECT TRIM('  bar   ');
        -> 'bar'
mysql> SELECT TRIM(LEADING 'x' FROM 'xxxbarxxx');
        -> 'barxxx'
mysql> SELECT TRIM(BOTH 'x' FROM 'xxxbarxxx');
        -> 'bar'
mysql> SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz');
        -> 'barx'
string-functionsQ"ISSyntax:
IS boolean_value, IS NOT boolean_value

Tests a value against a boolean value, where boolean_value can be TRUE,
FALSE, or UNKNOWN.
mysql> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;
        -> 1, 1, 1
mysql> SELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;
        -> 1, 1, 0
comparison-operators"
GET_FORMATSyntax:
GET_FORMAT(DATE|TIME|DATETIME, 'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL')

Returns a format string. This function is useful in combination with
the DATE_FORMAT() and the STR_TO_DATE() functions.
mysql> SELECT DATE_FORMAT('2003-10-03',GET_FORMAT(DATE,'EUR'));
        -> '03.10.2003'
mysql> SELECT STR_TO_DATE('10.31.2003',GET_FORMAT(DATE,'USA'));
        -> '2003-10-31'
date-and-time-functionsl2TINYBLOBETINYBLOB

A BLOB column with a maximum length of 255 (28 - 1) bytes.
string-type-overview82	SAVEPOINTSyntax:
SAVEPOINT identifier
ROLLBACK [WORK] TO SAVEPOINT identifier
RELEASE SAVEPOINT identifier

InnoDB supports the SQL statements SAVEPOINT and ROLLBACK TO SAVEPOINT.
Starting from MySQL 5.0.3, RELEASE SAVEPOINT and the optional WORK
keyword for ROLLBACK are supported as well.

savepoints"USERgSyntax:
USER()

Returns the current MySQL username and hostname as a string in the utf8
character set.
4mysql> SELECT USER();
        -> 'davida@localhost'
information-functions2
MPOINTFROMWKBMPointFromWKB(wkb[,srid]), MultiPointFromWKB(wkb[,srid])

Constructs a MULTIPOINT value using its WKB representation and SRID.
gis-wkb-functions-2ALTER TABLE$Syntax:
ALTER [IGNORE] TABLE tbl_name
    alter_specification [, alter_specification] ...

alter_specification:
    ADD [COLUMN] column_definition [FIRST | AFTER col_name ]
  | ADD [COLUMN] (column_definition,...)
  | ADD {INDEX|KEY} [index_name] [index_type] (index_col_name,...)
  | ADD [CONSTRAINT [symbol]]
        PRIMARY KEY [index_type] (index_col_name,...)
  | ADD [CONSTRAINT [symbol]]
        UNIQUE [INDEX|KEY] [index_name] [index_type] (index_col_name,...)
  | ADD [FULLTEXT|SPATIAL] [INDEX|KEY] [index_name] (index_col_name,...)
  | ADD [CONSTRAINT [symbol]]
        FOREIGN KEY [index_name] (index_col_name,...)
        [reference_definition]
  | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
  | CHANGE [COLUMN] old_col_name column_definition
        [FIRST|AFTER col_name]
  | MODIFY [COLUMN] column_definition [FIRST | AFTER col_name]
  | DROP [COLUMN] col_name
  | DROP PRIMARY KEY
  | DROP {INDEX|KEY} index_name
  | DROP FOREIGN KEY fk_symbol
  | DISABLE KEYS
  | ENABLE KEYS
  | RENAME [TO] new_tbl_name
  | ORDER BY col_name
  | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]
  | [DEFAULT] CHARACTER SET charset_name [COLLATE collation_name]
  | DISCARD TABLESPACE
  | IMPORT TABLESPACE
  | table_option ...

ALTER TABLE enables you to change the structure of an existing table.
For example, you can add or delete columns, create or destroy indexes,
change the type of existing columns, or rename columns or the table
itself. You can also change the comment for the table and type of the
table.
alter-table"PURGE MASTER LOGS(Syntax:
PURGE {MASTER | BINARY} LOGS TO 'log_name'
PURGE {MASTER | BINARY} LOGS BEFORE 'date'

Deletes all the binary logs listed in the log index prior to the
specified log or date. The logs also are removed from the list recorded
in the log index file, so that the given log becomes the first.
VPURGE MASTER LOGS TO 'mysql-bin.010';
PURGE MASTER LOGS BEFORE '2003-04-02 22:46:26';
purge-master-logs2	CHAR BYTE_The CHAR BYTE data type is an alias for the BINARY data type. This is a
compatibility feature.
string-type-overview2REPAIR TABLESyntax:
REPAIR [LOCAL | NO_WRITE_TO_BINLOG] TABLE
    tbl_name [, tbl_name] ... [QUICK] [EXTENDED] [USE_FRM]

REPAIR TABLE repairs a possibly corrupted table. By default, it has the
same effect as myisamchk --recover tbl_name. REPAIR TABLE works for
MyISAM and for ARCHIVE tables. See [myisam-storage-engine], and
[archive-storage-engine].

This statement requires SELECT and INSERT privileges for the table.
repair-tablet"MERGE$.The MERGE storage engine, also known as the MRG_MyISAM engine, is a
collection of identical MyISAM tables that can be used as one.
"Identical" means that all tables have identical column and index
information. You cannot merge MyISAM tables in which the columns are
listed in a different order, do not have exactly the same columns, or
have the indexes in different order. However, any or all of the MyISAM
tables can be compressed with myisampack. See [myisampack]. Differences
in table options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS do not
matter.
 mysql> CREATE TABLE t1 (
    ->    a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ->    message CHAR(20)) ENGINE=MyISAM;
mysql> CREATE TABLE t2 (
    ->    a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ->    message CHAR(20)) ENGINE=MyISAM;
mysql> INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1');
mysql> INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2');
mysql> CREATE TABLE total (
    ->    a INT NOT NULL AUTO_INCREMENT,
    ->    message CHAR(20), INDEX(a))
    ->    ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
merge-storage-engine
2CREATE TABLE$Syntax:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
    (create_definition,...)
    [table_option ...]

Or:

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
    [(create_definition,...)]
    [table_option ...]
    select_statement

Or:

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
    { LIKE old_tbl_name | (LIKE old_tbl_name) }

create_definition:
    column_definition
  | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)
  | {INDEX|KEY} [index_name] [index_type] (index_col_name,...)
  | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY]
      [index_name] [index_type] (index_col_name,...)
  | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)
  | [CONSTRAINT [symbol]] FOREIGN KEY
      [index_name] (index_col_name,...) [reference_definition]
  | CHECK (expr)

column_definition:
    col_name data_type [NOT NULL | NULL] [DEFAULT default_value]
      [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]
      [COMMENT 'string'] [reference_definition]

data_type:
    TINYINT[(length)] [UNSIGNED] [ZEROFILL]
  | SMALLINT[(length)] [UNSIGNED] [ZEROFILL]
  | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]
  | INT[(length)] [UNSIGNED] [ZEROFILL]
  | INTEGER[(length)] [UNSIGNED] [ZEROFILL]
  | BIGINT[(length)] [UNSIGNED] [ZEROFILL]
  | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
  | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]
  | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]
  | DECIMAL(length,decimals) [UNSIGNED] [ZEROFILL]
  | NUMERIC(length,decimals) [UNSIGNED] [ZEROFILL]
  | DATE
  | TIME
  | TIMESTAMP
  | DATETIME
  | YEAR
  | CHAR(length) [BINARY | ASCII | UNICODE]
  | VARCHAR(length) [BINARY]
  | BINARY(length)
  | VARBINARY(length)
  | TINYBLOB
  | BLOB
  | MEDIUMBLOB
  | LONGBLOB
  | TINYTEXT [BINARY]
  | TEXT [BINARY]
  | MEDIUMTEXT [BINARY]
  | LONGTEXT [BINARY]
  | ENUM(value1,value2,value3,...)
  | SET(value1,value2,value3,...)
  | spatial_type

index_col_name:
    col_name [(length)] [ASC | DESC]

reference_definition:
    REFERENCES tbl_name [(index_col_name,...)]
      [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]
      [ON DELETE reference_option]
      [ON UPDATE reference_option]

reference_option:
    RESTRICT | CASCADE | SET NULL | NO ACTION

table_option:
    {ENGINE|TYPE} [=] engine_name
  | AUTO_INCREMENT [=] value
  | AVG_ROW_LENGTH [=] value
  | [DEFAULT] CHARACTER SET charset_name
  | CHECKSUM [=] {0 | 1}
  | COLLATE collation_name
  | COMMENT [=] 'string'
  | CONNECTION [=] 'connect_string'
  | DATA DIRECTORY [=] 'absolute path to directory'
  | DELAY_KEY_WRITE [=] {0 | 1}
  | INDEX DIRECTORY [=] 'absolute path to directory'
  | INSERT_METHOD [=] { NO | FIRST | LAST }
  | MAX_ROWS [=] value
  | MIN_ROWS [=] value
  | PACK_KEYS [=] {0 | 1 | DEFAULT}
  | PASSWORD [=] 'string'
  | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}
  | UNION [=] (tbl_name[,tbl_name]...)

select_statement:
    [IGNORE | REPLACE] [AS] SELECT ...   (Some legal select statement)

CREATE TABLE creates a table with the given name. You must have the
CREATE privilege for the table.

Rules for allowable table names are given in [legal-names]. By default,
the table is created in the default database. An error occurs if the
table exists, if there is no default database, or if the database does
not exist.
create-table]">Syntax:
>

Greater than:
"mysql> SELECT 2 > 2;
        -> 0
comparison-operatorsX2
ANALYZE TABLE3Syntax:
ANALYZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name] ...

ANALYZE TABLE analyzes and stores the key distribution for a table.
During the analysis, the table is locked with a read lock. This
statement works with MyISAM, BDB, and InnoDB tables. For MyISAM tables,
this statement is equivalent to using myisamchk --analyze.

MySQL uses the stored key distribution to decide the order in which
tables should be joined when you perform a join on something other than
a constant.

This statement requires SELECT and INSERT privileges for the table.

analyze-table?"MICROSECONDSyntax:
MICROSECOND(expr)

Returns the microseconds from the time or datetime expression expr as a
number in the range from 0 to 999999.
mysql> SELECT MICROSECOND('12:00:00.123456');
        -> 123456
mysql> SELECT MICROSECOND('1997-12-31 23:59:59.000010');
        -> 10
date-and-time-functions^"
CONSTRAINT$^InnoDB also supports foreign key constraints. The syntax for a foreign
key constraint definition in InnoDB looks like this:

[CONSTRAINT symbol] FOREIGN KEY [id] (index_col_name, ...)
    REFERENCES tbl_name (index_col_name, ...)
    [ON DELETE {RESTRICT | CASCADE | SET NULL | NO ACTION}]
    [ON UPDATE {RESTRICT | CASCADE | SET NULL | NO ACTION}]
CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,
                      price DECIMAL,
                      PRIMARY KEY(category, id)) ENGINE=INNODB;
CREATE TABLE customer (id INT NOT NULL,
                       PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,
                            product_category INT NOT NULL,
                            product_id INT NOT NULL,
                            customer_id INT NOT NULL,
                            PRIMARY KEY(no),
                            INDEX (product_category, product_id),
                            FOREIGN KEY (product_category, product_id)
                              REFERENCES product(category, id)
                              ON UPDATE CASCADE ON DELETE RESTRICT,
                            INDEX (customer_id),
                            FOREIGN KEY (customer_id)
                              REFERENCES customer(id)) ENGINE=INNODB;
innodb-foreign-key-constraints"FIELD!Syntax:
FIELD(str,str1,str2,str3,...)

Returns the index (position) of str in the str1, str2, str3, ... list.
Returns 0 if str is not found.

If all arguments to FIELD() are strings, all arguments are compared as
strings. If all arguments are numbers, they are compared as numbers.
Otherwise, the arguments are compared as double.

If str is NULL, the return value is 0 because NULL fails equality
comparison with any value. FIELD() is the complement of ELT().
mysql> SELECT FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo');
        -> 2
mysql> SELECT FIELD('fo', 'Hej', 'ej', 'Heja', 'hej', 'foo');
        -> 0
string-functions"MAKETIMEsSyntax:
MAKETIME(hour,minute,second)

Returns a time value calculated from the hour, minute, and second
arguments.
8mysql> SELECT MAKETIME(12,15,30);
        -> '12:15:30'
date-and-time-functions2"CURDATESyntax:
CURDATE()

Returns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD format,
depending on whether the function is used in a string or numeric
context.
bmysql> SELECT CURDATE();
        -> '1997-12-15'
mysql> SELECT CURDATE() + 0;
        -> 19971215
date-and-time-functions_"MIN MAXSyntax:
MIN([DISTINCT] expr), MAX([DISTINCT] expr)

Returns the minimum or maximum value of expr. MIN() and MAX() may take
a string argument; in such cases they return the minimum or maximum
string value. See [mysql-indexes]. The DISTINCT keyword can be used to
find the minimum or maximum of the distinct values of expr, however,
this produces the same result as omitting DISTINCT.

MIN() and MAX() return NULL if there were no matching rows.
}mysql> SELECT student_name, MIN(test_score), MAX(test_score)
    ->        FROM student
    ->        GROUP BY student_name;
group-by-functions2SET PASSWORD}Syntax:
SET PASSWORD [FOR user] = PASSWORD('some password')

The SET PASSWORD statement assigns a password to an existing MySQL user
account.

With no FOR clause, this statement sets the password for the current
user. Any client that has connected to the server using a non-anonymous
account can change the password for that account.

With a FOR clause, this statement sets the password for a specific
account on the current server host. Only clients that have the UPDATE
privilege for the mysql database can do this. The user value should be
given in user_name@host_name format, where user_name and host_name are
exactly as they are listed in the User and Host columns of the
mysql.user table entry. For example, if you had an entry with User and
Host column values of 'bob' and '%.loc.gov', you would write the
statement like this:

SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
set-passwordK2ENUM(ENUM('value1','value2',...)

An enumeration. A string object that can have only one value, chosen
from the list of values 'value1', 'value2', ..., NULL or the special ''
error value. An ENUM column can have a maximum of 65,535 distinct
values. ENUM values are represented internally as integers.
string-type-overview"IF FUNCTIONSyntax:
IF(expr1,expr2,expr3)

If expr1 is TRUE (expr1 <> 0 and expr1 <> NULL) then IF() returns
expr2; otherwise it returns expr3. IF() returns a numeric or string
value, depending on the context in which it is used.
mysql> SELECT IF(1>2,2,3);
        -> 3
mysql> SELECT IF(1<2,'yes','no');
        -> 'yes'
mysql> SELECT IF(STRCMP('test','test1'),'no','yes');
        -> 'no'
control-flow-functions"DATABASEbSyntax:
DATABASE()

Returns the default (current) database name as a string in the utf8
character set. If there is no default database, DATABASE() returns
NULL. Within a stored routine, the default database is the database
that the routine is associated with, which is not necessarily the same
as the database that is the default in the calling context.
,mysql> SELECT DATABASE();
        -> 'test'
information-functions2POINTFROMWKBZPointFromWKB(wkb[,srid])

Constructs a POINT value using its WKB representation and SRID.
gis-wkb-functions"POWEROSyntax:
POW(X,Y), POWER(X,Y)

Returns the value of X raised to the power of Y.
Nmysql> SELECT POW(2,2);
        -> 4
mysql> SELECT POW(2,-2);
        -> 0.25
mathematical-functions"ATANVSyntax:
ATAN(X)

Returns the arc tangent of X, that is, the value whose tangent is X.
fmysql> SELECT ATAN(2);
        -> 1.1071487177941
mysql> SELECT ATAN(-2);
        -> -1.1071487177941
mathematical-functions"STRCMP!Syntax:
STRCMP(expr1,expr2)

STRCMP() returns 0 if the strings are the same, -1 if the first
argument is smaller than the second according to the current sort
order, and 1 otherwise.
mysql> SELECT STRCMP('text', 'text2');
        -> -1
mysql> SELECT STRCMP('text2', 'text');
        -> 1
mysql> SELECT STRCMP('text', 'text');
        -> 0
string-comparison-functions	52INSERT DELAYED	Syntax:
INSERT DELAYED ...

The DELAYED option for the INSERT statement is a MySQL extension to
standard SQL that is very useful if you have clients that cannot or
need not wait for the INSERT to complete. This is a common situation
when you use MySQL for logging and you also periodically run SELECT and
UPDATE statements that take a long time to complete.

When a client uses INSERT DELAYED, it gets an okay from the server at
once, and the row is queued to be inserted when the table is not in use
by any other thread.

Another major benefit of using INSERT DELAYED is that inserts from many
clients are bundled together and written in one block. This is much
faster than performing many separate inserts.

Note that INSERT DELAYED is slower than a normal INSERT if the table is
not otherwise in use. There is also the additional overhead for the
server to handle a separate thread for each table for which there are
delayed rows. This means that you should use INSERT DELAYED only when
you are really sure that you need it.

The queued rows are held only in memory until they are inserted into
the table. This means that if you terminate mysqld forcibly (for
example, with kill -9) or if mysqld dies unexpectedly, any queued rows
that have not been written to disk are lost.

There are some constraints on the use of DELAYED:

o INSERT DELAYED works only with MyISAM, MEMORY, and ARCHIVE tables.
  See [myisam-storage-engine], [memory-storage-engine], and
  [archive-storage-engine].

  For MyISAM tables, if there are no free blocks in the middle of the
  data file, concurrent SELECT and INSERT statements are supported.
  Under these circumstances, you very seldom need to use INSERT DELAYED
  with MyISAM.

o INSERT DELAYED should be used only for INSERT statements that specify
  value lists. The server ignores DELAYED for INSERT ... SELECT or
  INSERT ... ON DUPLICATE KEY UPDATE statements.

o Because the INSERT DELAYED statement returns immediately, before the
  rows are inserted, you cannot use LAST_INSERT_ID() to get the
  AUTO_INCREMENT value that the statement might generate.

o DELAYED rows are not visible to SELECT statements until they actually
  have been inserted.

o DELAYED is ignored on slave replication servers because it could
  cause the slave to have different data than the master.
insert-delayed}2
MEDIUMTEXTTMEDIUMTEXT

A TEXT column with a maximum length of 16,777,215 (224 - 1) characters.
string-type-overview"LNWSyntax:
LN(X)

Returns the natural logarithm of X; that is, the base-e logarithm of X.
Wmysql> SELECT LN(2);
        -> 0.69314718055995
mysql> SELECT LN(-2);
        -> NULL
mathematical-functionsS2SHOW COLLATION,Syntax:
SHOW COLLATION [LIKE 'pattern']

The output from SHOW COLLATION includes all available character sets.
It takes an optional LIKE clause whose pattern indicates which
collation names to match. For example:

mysql> SHOW COLLATION LIKE 'latin1%';
+-------------------+---------+----+---------+----------+---------+
| Collation         | Charset | Id | Default | Compiled | Sortlen |
+-------------------+---------+----+---------+----------+---------+
| latin1_german1_ci | latin1  |  5 |         |          |       0 |
| latin1_swedish_ci | latin1  |  8 | Yes     | Yes      |       0 |
| latin1_danish_ci  | latin1  | 15 |         |          |       0 |
| latin1_german2_ci | latin1  | 31 |         | Yes      |       2 |
| latin1_bin        | latin1  | 47 |         | Yes      |       0 |
| latin1_general_ci | latin1  | 48 |         |          |       0 |
| latin1_general_cs | latin1  | 49 |         |          |       0 |
| latin1_spanish_ci | latin1  | 94 |         |          |       0 |
+-------------------+---------+----+---------+----------+---------+
show-collation"LOGjSyntax:
LOG(X), LOG(B,X)

If called with one parameter, this function returns the natural
logarithm of X.
Ymysql> SELECT LOG(2);
        -> 0.69314718055995
mysql> SELECT LOG(-2);
        -> NULL
mathematical-functions&2SET SQL_LOG_BINSyntax:
SET SQL_LOG_BIN = {0|1}

Disables or enables binary logging for the current connection
(SQL_LOG_BIN is a session variable) if the client has the SUPER
privilege. The statement is refused with an error if the client does
not have that privilege.
set-sql-log-bin"!=Syntax:
<>, !=

Not equal:
mysql> SELECT '.01' <> '0.01';
        -> 1
mysql> SELECT .01 <> '0.01';
        -> 0
mysql> SELECT 'zapp' <> 'zappp';
        -> 1
comparison-operators"WHILE#|Syntax:
[begin_label:] WHILE search_condition DO
    statement_list
END WHILE [end_label]

The statement list within a WHILE statement is repeated as long as the
search_condition is true. statement_list consists of one or more
statements.

A WHILE statement can be labeled. end_label cannot be given unless
begin_label also is present. If both are present, they must be the
same.
~CREATE PROCEDURE dowhile()
BEGIN
  DECLARE v1 INT DEFAULT 5;

  WHILE v1 > 0 DO
    ...
    SET v1 = v1 - 1;
  END WHILE;
END
while-statement"AES_DECRYPT
Syntax:
AES_ENCRYPT(str,key_str), AES_DECRYPT(crypt_str,key_str)

These functions allow encryption and decryption of data using the
official AES (Advanced Encryption Standard) algorithm, previously known
as "Rijndael." Encoding with a 128-bit key length is used, but you can
extend it up to 256 bits by modifying the source. We chose 128 bits
because it is much faster and it is secure enough for most purposes.

AES_ENCRYPT() encrypts a string and returns a binary string.
AES_DESCRIPT() descrypts the encrypted string and returns the original
string. The input arguments may be any length. If either argument is
NULL, the result of this function is also NULL.

Because AES is a block-level algorithm, padding is used to encode
uneven length strings and so the result string length may be calculated
using this formula:

16 × (trunc(string_length / 16) + 1)

If AES_DECRYPT() detects invalid data or incorrect padding, it returns
NULL. However, it is possible for AES_DECRYPT() to return a non-NULL
value (possibly garbage) if the input data or the key is invalid.

You can use the AES functions to store data in an encrypted form by
modifying your queries:
9INSERT INTO t VALUES (1,AES_ENCRYPT('text','password'));
encryption-functions"DAYNAMEASyntax:
DAYNAME(date)

Returns the name of the weekday for date.
;mysql> SELECT DAYNAME('1998-02-05');
        -> 'Thursday'
date-and-time-functions5"COERCIBILITY\Syntax:
COERCIBILITY(str)

Returns the collation coercibility value of the string argument.
mysql> SELECT COERCIBILITY('abc' COLLATE latin1_swedish_ci);
        -> 0
mysql> SELECT COERCIBILITY(USER());
        -> 3
mysql> SELECT COERCIBILITY('abc');
        -> 4
information-functions2INTINT[(M)] [UNSIGNED] [ZEROFILL]

A normal-size integer. The signed range is -2147483648 to 2147483647.
The unsigned range is 0 to 4294967295.
numeric-type-overview"GLENGTH}GLength(ls)

Returns as a double-precision number the length of the LineString value
ls in its associated spatial reference.
mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
mysql> SELECT GLength(GeomFromText(@ls));
+----------------------------+
| GLength(GeomFromText(@ls)) |
+----------------------------+
|            2.8284271247462 |
+----------------------------+
linestring-property-functions"RADIANS}Syntax:
RADIANS(X)

Returns the argument X, converted from degrees to radians. (Note that
Ï€ radians equals 180 degrees.)
6mysql> SELECT RADIANS(90);
        -> 1.5707963267949
mathematical-functions"	COLLATIONFSyntax:
COLLATION(str)

Returns the collation of the string argument.
mysql> SELECT COLLATION('abc');
        -> 'latin1_swedish_ci'
mysql> SELECT COLLATION(_utf8'abc');
        -> 'utf8_general_ci'
information-functions"COALESCEtSyntax:
COALESCE(value,...)

Returns the first non-NULL value in the list, or NULL if there are no
non-NULL values.
emysql> SELECT COALESCE(NULL,1);
        -> 1
mysql> SELECT COALESCE(NULL,NULL,NULL);
        -> NULL
comparison-operators"VERSIONuSyntax:
VERSION()

Returns a string that indicates the MySQL server version. The string
uses the utf8 character set.
6mysql> SELECT VERSION();
        -> '5.0.23-standard'
information-functions_"MAKE_SET!2Syntax:
MAKE_SET(bits,str1,str2,...)

Returns a set value (a string containing substrings separated by `,'
characters) consisting of the strings that have the corresponding bit
in bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL
values in str1, str2, ... are not appended to the result.
mysql> SELECT MAKE_SET(1,'a','b','c');
        -> 'a'
mysql> SELECT MAKE_SET(1 | 4,'hello','nice','world');
        -> 'hello,world'
mysql> SELECT MAKE_SET(1 | 4,'hello','nice',NULL,'world');
        -> 'hello'
mysql> SELECT MAKE_SET(0,'a','b','c');
        -> ''
string-functions"FIND_IN_SET!ASyntax:
FIND_IN_SET(str,strlist)

Returns a value in the range of 1 to N if the string str is in the
string list strlist consisting of N substrings. A string list is a
string composed of substrings separated by `,' characters. If the first
argument is a constant string and the second is a column of type SET,
the FIND_IN_SET() function is optimized to use bit arithmetic. Returns
0 if str is not in strlist or if strlist is the empty string. Returns
NULL if either argument is NULL. This function does not work properly
if the first argument contains a comma (`,') character.
7mysql> SELECT FIND_IN_SET('b','a,b,c,d');
        -> 2
string-functions

Hacked By AnonymousFox1.0, Coded By AnonymousFox