|
The following are useful extensions that MySQL that you probably won't find in other SQL:s. Be warned that if you use this your code won't be portable to other SQL servers.
- Use of
INTO OUTFILE in a SELECT statement. See section SELECT syntax
- Use of key names, keys on a subpart of a field, and use of
KEY or INDEX in a CREATE TABLE statement. See section CREATE TABLE syntax.
- Use of
DROP column or CHANGE column in a ALTER TABLE statement. See section ALTER TABLE syntax
- Use of
LOAD DATA INFILE. This syntax is in many cases compatible with Oracles LOAD DATA INFILE. See section LOAD DATA INFILE syntax
- Using
" instead of ' to enclose strings.
- Using the escape
\ character.
- The
SET OPTION statement.
- Using in the
SELECT part of a GROUP BY statement fields or functions that doesn't appear in the GROUP BY list. In MySQL this means 'any matching value'. By using this one can get much higher performance by avoiding sorting and grouping on unnecessary items. This is often used in this context:
SELECT order.customerid,customer.name,max(payments) from order,customer
WHERE order.customerid = customer.customerid GROUP BY order.customerid;
In ANSI SQL you should have to add the customer.name in the GROUP BY clause, but in MySQL you don't have to.
- Use of any of the following functions:
=, <>, <= ,<, >=,>, AND, OR, or LIKE in a column statement
REGEXP or NOT REGEXP.
CONCAT() with other than 2 arguments. MySQL can take any number of arguments.
BIT_COUNT(), ELT(), FROM_DAYS(), FORMAT(), IF(), PASSWORD(), PERIOD_ADD(), PERIOD_DIFF(), TO_DAYS(), or WEEKDAY().
- The
STD() group function.
- Use of
MIN() or MAX() as functions, not group functions.
|