Functions: ABS() Return the absolute value ACOS() Return the arc cosine ADDDATE() Add time values (intervals) to a date value ADDTIME() Add time AES_DECRYPT() Decrypt using AES AES_ENCRYPT() Encrypt using AES AND, && Logical AND ASCII() Return numeric value of left-most character ASIN() Return the arc sine = Assign a value (as part of a SET statement, or as part of the SET clause in an UPDATE statement) := Assign a value ATAN2(), ATAN() Return the arc tangent of the two arguments ATAN() Return the arc tangent AVG() Return the average value of the argument BENCHMARK() Repeatedly execute an expression BETWEEN ... AND ... Check whether a value is within a range of values BIN() Return a string representation of the argument BINARY Cast a string to a binary string BIT_AND() Return bitwise and BIT_COUNT() Return the number of bits that are set BIT_LENGTH() Return length of argument in bits BIT_OR() Return bitwise or BIT_XOR() Return bitwise xor & Bitwise AND ~ Invert bits | Bitwise OR ^ Bitwise XOR CASE Case operator CAST() Cast a value as a certain type CEIL() Return the smallest integer value not less than the argument CEILING() Return the smallest integer value not less than the argument CHAR_LENGTH() Return number of characters in argument CHAR() Return the character for each integer passed CHARACTER_LENGTH() A synonym for CHAR_LENGTH() CHARSET() Return the character set of the argument COALESCE() Return the first non-NULL argument COERCIBILITY() Return the collation coercibility value of the string argument COLLATION() Return the collation of the string argument COMPRESS() Return result as a binary string CONCAT_WS() Return concatenate with separator CONCAT() Return concatenated string CONNECTION_ID() Return the connection ID (thread ID) for the connection CONV() Convert numbers between different number bases CONVERT_TZ() Convert from one timezone to another CONVERT() Cast a value as a certain type COS() Return the cosine COT() Return the cotangent COUNT(DISTINCT) Return the count of a number of different values COUNT() Return a count of the number of rows returned CRC32() Compute a cyclic redundancy check value CURDATE() Return the current date CURRENT_DATE(), CURRENT_DATE Synonyms for CURDATE() CURRENT_TIME(), CURRENT_TIME Synonyms for CURTIME() CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP Synonyms for NOW() CURRENT_USER(), CURRENT_USER The authenticated user name and host name CURTIME() Return the current time DATABASE() Return the default (current) database name DATE_ADD() Add time values (intervals) to a date value DATE_FORMAT() Format date as specified DATE_SUB() Subtract a time value (interval) from a date DATE() Extract the date part of a date or datetime expression DATEDIFF() Subtract two dates DAY() Synonym for DAYOFMONTH() DAYNAME() Return the name of the weekday DAYOFMONTH() Return the day of the month (0-31) DAYOFWEEK() Return the weekday index of the argument DAYOFYEAR() Return the day of the year (1-366) DECODE() Decodes a string encrypted using ENCODE() DEFAULT() Return the default value for a table column DEGREES() Convert radians to degrees DES_DECRYPT() Decrypt a string DES_ENCRYPT() Encrypt a string DIV Integer division / Division operator ELT() Return string at index number ENCODE() Encode a string ENCRYPT() Encrypt a string <=> NULL-safe equal to operator = Equal operator EXP() Raise to the power of EXPORT_SET() Return a string such that for every bit set in the value bits, you get an on string and for every unset bit, you get an off string EXTRACT() Extract part of a date ExtractValue() Extracts a value from an XML string using XPath notation FIELD() Return the index (position) of the first argument in the subsequent arguments FIND_IN_SET() Return the index position of the first argument within the second argument FLOOR() Return the largest integer value not greater than the argument FORMAT() Return a number formatted to specified number of decimal places FOUND_ROWS() For a SELECT with a LIMIT clause, the number of rows that would be returned were there no LIMIT clause FROM_DAYS() Convert a day number to a date FROM_UNIXTIME() Format UNIX timestamp as a date GET_FORMAT() Return a date format string GET_LOCK() Get a named lock >= Greater than or equal operator > Greater than operator GREATEST() Return the largest argument GROUP_CONCAT() Return a concatenated string HEX() Return a hexadecimal representation of a decimal or string value HOUR() Extract the hour IF() If/else construct IFNULL() Null if/else construct IN() Check whether a value is within a set of values INET_ATON() Return the numeric value of an IP address INET_NTOA() Return the IP address from a numeric value INSERT() Insert a substring at the specified position up to the specified number of characters INSTR() Return the index of the first occurrence of substring INTERVAL() Return the index of the argument that is less than the first argument IS_FREE_LOCK() Checks whether the named lock is free IS NOT NULL NOT NULL value test IS NOT Test a value against a boolean IS NULL NULL value test IS_USED_LOCK() Checks whether the named lock is in use. Return connection identifier if true. IS Test a value against a boolean ISNULL() Test whether the argument is NULL LAST_DAY Return the last day of the month for the argument LAST_INSERT_ID() Value of the AUTOINCREMENT column for the last INSERT LCASE() Synonym for LOWER() LEAST() Return the smallest argument << Left shift LEFT() Return the leftmost number of characters as specified LENGTH() Return the length of a string in bytes <= Less than or equal operator < Less than operator LIKE Simple pattern matching LN() Return the natural logarithm of the argument LOAD_FILE() Load the named file LOCALTIME(), LOCALTIME Synonym for NOW() LOCALTIMESTAMP, LOCALTIMESTAMP() Synonym for NOW() LOCATE() Return the position of the first occurrence of substring LOG10() Return the base-10 logarithm of the argument LOG2() Return the base-2 logarithm of the argument LOG() Return the natural logarithm of the first argument LOWER() Return the argument in lowercase LPAD() Return the string argument, left-padded with the specified string LTRIM() Remove leading spaces MAKE_SET() Return a set of comma-separated strings that have the corresponding bit in bits set MAKEDATE() Create a date from the year and day of year MAKETIME MAKETIME() MASTER_POS_WAIT() Block until the slave has read and applied all updates up to the specified position MATCH Perform full-text search MAX() Return the maximum value MD5() Calculate MD5 checksum MICROSECOND() Return the microseconds from argument MID() Return a substring starting from the specified position MIN() Return the minimum value - Minus operator MINUTE() Return the minute from the argument MOD() Return the remainder % or MOD Modulo operator MONTH() Return the month from the date passed MONTHNAME() Return the name of the month NAME_CONST() Causes the column to have the given name NOT BETWEEN ... AND ... Check whether a value is not within a range of values !=, <> Not equal operator NOT IN() Check whether a value is not within a set of values NOT LIKE Negation of simple pattern matching NOT REGEXP Negation of REGEXP NOT, ! Negates value NOW() Return the current date and time NULLIF() Return NULL if expr1 = expr2 OCT() Return an octal representation of a decimal number OCTET_LENGTH() A synonym for LENGTH() OLD_PASSWORD() Return the value of the pre-4.1 implementation of PASSWORD ||, OR Logical OR ORD() Return character code for leftmost character of the argument PASSWORD() Calculate and return a password string PERIOD_ADD() Add a period to a year-month PERIOD_DIFF() Return the number of months between periods PI() Return the value of pi + Addition operator POSITION() A synonym for LOCATE() POW() Return the argument raised to the specified power POWER() Return the argument raised to the specified power PROCEDURE ANALYSE() Analyze the results of a query QUARTER() Return the quarter from a date argument QUOTE() Escape the argument for use in an SQL statement RADIANS() Return argument converted to radians RAND() Return a random floating-point value REGEXP Pattern matching using regular expressions RELEASE_LOCK() Releases the named lock REPEAT() Repeat a string the specified number of times REPLACE() Replace occurrences of a specified string REVERSE() Reverse the characters in a string >> Right shift RIGHT() Return the specified rightmost number of characters RLIKE Synonym for REGEXP ROUND() Round the argument ROW_COUNT() The number of rows updated RPAD() Append string the specified number of times RTRIM() Remove trailing spaces SCHEMA() A synonym for DATABASE() SEC_TO_TIME() Converts seconds to 'HH:MM:SS' format SECOND() Return the second (0-59) SESSION_USER() Synonym for USER() SHA1(), SHA() Calculate an SHA-1 160-bit checksum SHA2() Calculate an SHA-2 checksum SIGN() Return the sign of the argument SIN() Return the sine of the argument SLEEP() Sleep for a number of seconds SOUNDEX() Return a soundex string SOUNDS LIKE Compare sounds SPACE() Return a string of the specified number of spaces SQRT() Return the square root of the argument STD() Return the population standard deviation STDDEV_POP() Return the population standard deviation STDDEV_SAMP() Return the sample standard deviation STDDEV() Return the population standard deviation STR_TO_DATE() Convert a string to a date STRCMP() Compare two strings SUBDATE() A synonym for DATE_SUB() when invoked with three arguments SUBSTR() Return the substring as specified SUBSTRING_INDEX() Return a substring from a string before the specified number of occurrences of the delimiter SUBSTRING() Return the substring as specified SUBTIME() Subtract times SUM() Return the sum SYSDATE() Return the time at which the function executes SYSTEM_USER() Synonym for USER() TAN() Return the tangent of the argument TIME_FORMAT() Format as time TIME_TO_SEC() Return the argument converted to seconds TIME() Extract the time portion of the expression passed TIMEDIFF() Subtract time * Multiplication operator TIMESTAMP() With a single argument, this function returns the date or datetime expression; with two arguments, the sum of the arguments TIMESTAMPADD() Add an interval to a datetime expression TIMESTAMPDIFF() Subtract an interval from a datetime expression TO_DAYS() Return the date argument converted to days TO_SECONDS() Return the date or datetime argument converted to seconds since Year 0 TRIM() Remove leading and trailing spaces TRUNCATE() Truncate to specified number of decimal places UCASE() Synonym for UPPER() - Change the sign of the argument UNCOMPRESS() Uncompress a string compressed UNCOMPRESSED_LENGTH() Return the length of a string before compression UNHEX() Convert each pair of hexadecimal digits to a character UNIX_TIMESTAMP() Return a UNIX timestamp UpdateXML() Return replaced XML fragment UPPER() Convert to uppercase USER() The user name and host name provided by the client UTC_DATE() Return the current UTC date UTC_TIME() Return the current UTC time UTC_TIMESTAMP() Return the current UTC date and time UUID_SHORT() Return an integer-valued universal identifier UUID() Return a Universal Unique Identifier (UUID) VALUES() Defines the values to be used during an INSERT VAR_POP() Return the population standard variance VAR_SAMP() Return the sample variance VARIANCE() Return the population standard variance VERSION() Returns a string that indicates the MySQL server version WEEK() Return the week number WEEKDAY() Return the weekday index WEEKOFYEAR() Return the calendar week of the date (0-53) XOR Logical XOR YEAR() Return the year YEARWEEK() ======================================================================== Operators: Logical AND = Assign a value (as part of a SET statement, or as part of the SET clause in an UPDATE statement) := Assign a value BETWEEN ... AND ... Check whether a value is within a range of values BINARY Cast a string to a binary string & Bitwise AND ~ Invert bits | Bitwise OR ^ Bitwise XOR CASE Case operator DIV Integer division / Division operator <=> NULL-safe equal to operator = Equal operator >= Greater than or equal operator > Greater than operator IS NOT NULL NOT NULL value test IS NOT Test a value against a boolean IS NULL NULL value test IS Test a value against a boolean << Left shift <= Less than or equal operator < Less than operator LIKE Simple pattern matching - Minus operator % or MOD Modulo operator NOT BETWEEN ... AND ... Check whether a value is not within a range of values !=, <> Not equal operator NOT LIKE Negation of simple pattern matching NOT REGEXP Negation of REGEXP NOT, ! Negates value ||, OR Logical OR + Addition operator REGEXP Pattern matching using regular expressions >> Right shift RLIKE Synonym for REGEXP SOUNDS LIKE Compare sounds * Multiplication operator - Change the sign of the argument XOR Logical XOR ======================================================================== Comparison operators BETWEEN ... AND ... Check whether a value is within a range of values COALESCE() Return the first non-NULL argument <=> NULL-safe equal to operator = Equal operator >= Greater than or equal operator > Greater than operator GREATEST() Return the largest argument IN() Check whether a value is within a set of values INTERVAL() Return the index of the argument that is less than the first argument IS NOT NULL NOT NULL value test IS NOT Test a value against a boolean IS NULL NULL value test IS Test a value against a boolean ISNULL() Test whether the argument is NULL LEAST() Return the smallest argument <= Less than or equal operator < Less than operator LIKE Simple pattern matching NOT BETWEEN ... AND ... Check whether a value is not within a range of values !=, <> Not equal operator NOT IN() Check whether a value is not within a set of values NOT LIKE Negation of simple pattern matching STRCMP() Compare two strings ======================================================================== 2.5. String Functions 12.5.1. String Comparison Functions 12.5.2. Regular Expressions Table 12.7. String Operators Name Description ASCII() Return numeric value of left-most character BIN() Return a string representation of the argument BIT_LENGTH() Return length of argument in bits CHAR_LENGTH() Return number of characters in argument CHAR() Return the character for each integer passed CHARACTER_LENGTH() A synonym for CHAR_LENGTH() CONCAT_WS() Return concatenate with separator CONCAT() Return concatenated string ELT() Return string at index number EXPORT_SET() Return a string such that for every bit set in the value bits, you get an on string and for every unset bit, you get an off string FIELD() Return the index (position) of the first argument in the subsequent arguments FIND_IN_SET() Return the index position of the first argument within the second argument FORMAT() Return a number formatted to specified number of decimal places HEX() Return a hexadecimal representation of a decimal or string value INSERT() Insert a substring at the specified position up to the specified number of characters INSTR() Return the index of the first occurrence of substring LCASE() Synonym for LOWER() LEFT() Return the leftmost number of characters as specified LENGTH() Return the length of a string in bytes LIKE Simple pattern matching LOAD_FILE() Load the named file LOCATE() Return the position of the first occurrence of substring LOWER() Return the argument in lowercase LPAD() Return the string argument, left-padded with the specified string LTRIM() Remove leading spaces MAKE_SET() Return a set of comma-separated strings that have the corresponding bit in bits set MATCH Perform full-text search MID() Return a substring starting from the specified position NOT LIKE Negation of simple pattern matching NOT REGEXP Negation of REGEXP OCTET_LENGTH() A synonym for LENGTH() ORD() Return character code for leftmost character of the argument POSITION() A synonym for LOCATE() QUOTE() Escape the argument for use in an SQL statement REGEXP Pattern matching using regular expressions REPEAT() Repeat a string the specified number of times REPLACE() Replace occurrences of a specified string REVERSE() Reverse the characters in a string RIGHT() Return the specified rightmost number of characters RLIKE Synonym for REGEXP RPAD() Append string the specified number of times RTRIM() Remove trailing spaces SOUNDEX() Return a soundex string SOUNDS LIKE Compare sounds SPACE() Return a string of the specified number of spaces STRCMP() Compare two strings SUBSTR() Return the substring as specified SUBSTRING_INDEX() Return a substring from a string before the specified number of occurrences of the delimiter SUBSTRING() Return the substring as specified TRIM() Remove leading and trailing spaces UCASE() Synonym for UPPER() UNHEX() Convert each pair of hexadecimal digits to a character UPPER() Convert to uppercase ======================================================================== 12.7. Date and Time Functions This section describes the functions that can be used to manipulate temporal values. See Section 11.3, Date and Time Types, for a description of the range of values each date and time type has and the valid formats in which values may be specified. Table 12.13. Date/Time Functions Name Description ADDDATE() Add time values (intervals) to a date value ADDTIME() Add time CONVERT_TZ() Convert from one timezone to another CURDATE() Return the current date CURRENT_DATE(), CURRENT_DATE Synonyms for CURDATE() CURRENT_TIME(), CURRENT_TIME Synonyms for CURTIME() CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP Synonyms for NOW() CURTIME() Return the current time DATE_ADD() Add time values (intervals) to a date value DATE_FORMAT() Format date as specified DATE_SUB() Subtract a time value (interval) from a date DATE() Extract the date part of a date or datetime expression DATEDIFF() Subtract two dates DAY() Synonym for DAYOFMONTH() DAYNAME() Return the name of the weekday DAYOFMONTH() Return the day of the month (0-31) DAYOFWEEK() Return the weekday index of the argument DAYOFYEAR() Return the day of the year (1-366) EXTRACT() Extract part of a date FROM_DAYS() Convert a day number to a date FROM_UNIXTIME() Format UNIX timestamp as a date GET_FORMAT() Return a date format string HOUR() Extract the hour LAST_DAY Return the last day of the month for the argument LOCALTIME(), LOCALTIME Synonym for NOW() LOCALTIMESTAMP, LOCALTIMESTAMP() Synonym for NOW() MAKEDATE() Create a date from the year and day of year MAKETIME MAKETIME() MICROSECOND() Return the microseconds from argument MINUTE() Return the minute from the argument MONTH() Return the month from the date passed MONTHNAME() Return the name of the month NOW() Return the current date and time PERIOD_ADD() Add a period to a year-month PERIOD_DIFF() Return the number of months between periods QUARTER() Return the quarter from a date argument SEC_TO_TIME() Converts seconds to 'HH:MM:SS' format SECOND() Return the second (0-59) STR_TO_DATE() Convert a string to a date SUBDATE() A synonym for DATE_SUB() when invoked with three arguments SUBTIME() Subtract times SYSDATE() Return the time at which the function executes TIME_FORMAT() Format as time TIME_TO_SEC() Return the argument converted to seconds TIME() Extract the time portion of the expression passed TIMEDIFF() Subtract time TIMESTAMP() With a single argument, this function returns the date or datetime expression; with two arguments, the sum of the arguments TIMESTAMPADD() Add an interval to a datetime expression TIMESTAMPDIFF() Subtract an interval from a datetime expression TO_DAYS() Return the date argument converted to days TO_SECONDS() Return the date or datetime argument converted to seconds since Year 0 UNIX_TIMESTAMP() Return a UNIX timestamp UTC_DATE() Return the current UTC date UTC_TIME() Return the current UTC time UTC_TIMESTAMP() Return the current UTC date and time WEEK() Return the week number WEEKDAY() Return the weekday index WEEKOFYEAR() Return the calendar week of the date (0-53) YEAR() Return the year YEARWEEK() Return the year and week ======================================================================== 12.14. Information Functions Table 12.18. Information FunctionsName Description BENCHMARK() Repeatedly execute an expression CHARSET() Return the character set of the argument COERCIBILITY() Return the collation coercibility value of the string argument COLLATION() Return the collation of the string argument CONNECTION_ID() Return the connection ID (thread ID) for the connection CURRENT_USER(), CURRENT_USER The authenticated user name and host name DATABASE() Return the default (current) database name FOUND_ROWS() For a SELECT with a LIMIT clause, the number of rows that would be returned were there no LIMIT clause LAST_INSERT_ID() Value of the AUTOINCREMENT column for the last INSERT ROW_COUNT() The number of rows updated SCHEMA() A synonym for DATABASE() SESSION_USER() Synonym for USER() SYSTEM_USER() Synonym for USER() USER() The user name and host name provided by the client VERSION() Returns a string that indicates the MySQL server version ======================================================================== 2.15. Miscellaneous Functions Table 12.19. Miscellaneous FunctionsName Description DEFAULT() Return the default value for a table column GET_LOCK() Get a named lock INET_ATON() Return the numeric value of an IP address INET_NTOA() Return the IP address from a numeric value IS_FREE_LOCK() Checks whether the named lock is free IS_USED_LOCK() Checks whether the named lock is in use. Return connection identifier if true. MASTER_POS_WAIT() Block until the slave has read and applied all updates up to the specified position NAME_CONST() Causes the column to have the given name RAND() Return a random floating-point value RELEASE_LOCK() Releases the named lock SLEEP() Sleep for a number of seconds UUID_SHORT() Return an integer-valued universal identifier UUID() Return a Universal Unique Identifier (UUID) VALUES() Defines the values to be used during an INSER ======================================================================== 2.16.1. GROUP BY (Aggregate) Functions Table 12.20. Aggregate (GROUP BY) FunctionsName Description AVG() Return the average value of the argument BIT_AND() Return bitwise and BIT_OR() Return bitwise or BIT_XOR() Return bitwise xor COUNT(DISTINCT) Return the count of a number of different values COUNT() Return a count of the number of rows returned GROUP_CONCAT() Return a concatenated string MAX() Return the maximum value MIN() Return the minimum value STD() Return the population standard deviation STDDEV_POP() Return the population standard deviation STDDEV_SAMP() Return the sample standard deviation STDDEV() Return the population standard deviation SUM() Return the sum VAR_POP() Return the population standard variance VAR_SAMP() Return the sample variance VARIANCE() Return the population standard variance ======================================================================== 13.1.17. CREATE TABLE Syntax [+/-] 13.1.17.1. CREATE TABLE ... SELECT Syntax 13.1.17.2. Silent Column Specification Changes CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (create_definition,...) [table_options] [partition_options] Or: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [partition_options] select_statement Or: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name { LIKE old_tbl_name | (LIKE old_tbl_name) } create_definition: col_name column_definition | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...) [index_option] ... | {INDEX|KEY} [index_name] [index_type] (index_col_name,...) [index_option] ... | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type] (index_col_name,...) [index_option] ... | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...) [index_option] ... | [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name,...) reference_definition | CHECK (expr) column_definition: data_type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY] [COMMENT 'string'] [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}] [STORAGE {DISK|MEMORY|DEFAULT}] [reference_definition] data_type: BIT[(length)] | 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)] [CHARACTER SET charset_name] [COLLATE collation_name] | VARCHAR(length) [CHARACTER SET charset_name] [COLLATE collation_name] | BINARY[(length)] | VARBINARY(length) | TINYBLOB | BLOB | MEDIUMBLOB | LONGBLOB | TINYTEXT [BINARY] [CHARACTER SET charset_name] [COLLATE collation_name] | TEXT [BINARY] [CHARACTER SET charset_name] [COLLATE collation_name] | MEDIUMTEXT [BINARY] [CHARACTER SET charset_name] [COLLATE collation_name] | LONGTEXT [BINARY] [CHARACTER SET charset_name] [COLLATE collation_name] | ENUM(value1,value2,value3,...) [CHARACTER SET charset_name] [COLLATE collation_name] | SET(value1,value2,value3,...) [CHARACTER SET charset_name] [COLLATE collation_name] | spatial_type index_col_name: col_name [(length)] [ASC | DESC] index_type: USING {BTREE | HASH} index_option: KEY_BLOCK_SIZE [=] value | index_type | WITH PARSER parser_name | COMMENT 'string' 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_options: table_option [[,] table_option] ... table_option: ENGINE [=] engine_name | AUTO_INCREMENT [=] value | AVG_ROW_LENGTH [=] value | [DEFAULT] CHARACTER SET [=] charset_name | CHECKSUM [=] {0 | 1} | [DEFAULT] 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 } | KEY_BLOCK_SIZE [=] value | MAX_ROWS [=] value | MIN_ROWS [=] value | PACK_KEYS [=] {0 | 1 | DEFAULT} | PASSWORD [=] 'string' | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT} | TABLESPACE tablespace_name [STORAGE {DISK|MEMORY|DEFAULT}] /*For NDB*/ | UNION [=] (tbl_name[,tbl_name]...) partition_options: PARTITION BY { [LINEAR] HASH(expr) | [LINEAR] KEY(column_list) | RANGE{(expr) | COLUMNS(column_list)} | LIST{(expr) | COLUMNS(column_list)} } [PARTITIONS num] [SUBPARTITION BY { [LINEAR] HASH(expr) | [LINEAR] KEY(column_list) } [SUBPARTITIONS num] ] [(partition_definition [, partition_definition] ...)] partition_definition: PARTITION partition_name [VALUES {LESS THAN {(expr | value_list) | MAXVALUE} | IN (value_list)}] [[STORAGE] ENGINE [=] engine_name] [COMMENT [=] 'comment_text' ] [DATA DIRECTORY [=] 'data_dir'] [INDEX DIRECTORY [=] 'index_dir'] [MAX_ROWS [=] max_number_of_rows] [MIN_ROWS [=] min_number_of_rows] [TABLESPACE [=] tablespace_name] [NODEGROUP [=] node_group_id] [(subpartition_definition [, subpartition_definition] ...)] subpartition_definition: SUBPARTITION logical_name [[STORAGE] ENGINE [=] engine_name] [COMMENT [=] 'comment_text' ] [DATA DIRECTORY [=] 'data_dir'] [INDEX DIRECTORY [=] 'index_dir'] [MAX_ROWS [=] max_number_of_rows] /* Hint */ [MIN_ROWS [=] min_number_of_rows] /* Hint */ [TABLESPACE [=] tablespace_name] /* For NDB only? */ [NODEGROUP [=] node_group_id] select_statement: [IGNORE | REPLACE] [AS] SELECT ... (Some valid select statement) ========================================================================