=pod =head1 NAME SQL::Statement::Syntax - documentation of SQL::Statement's SQL Syntax =head1 SYNOPSIS See L for usage. =head1 DESCRIPTION The SQL::Statement module can be used either from a DBI driver like DBD::CSV or directly. The syntax below applies to both situations. In the case of DBDs, each DBD can implement its own sub-dialect so be sure to check the DBD documentation also. SQL::Statement is meant primarily as a base class for DBD drivers and as such concentrates on a small but useful subset of SQL. It does *not* in any way pretend to be a complete SQL parser for all dialects of SQL. The module will continue to add new supported syntax, and users may also extend the syntax (see L<#Extending the SQL syntax>). =head1 USAGE =head2 Default Supported SQL syntax - Summary B CALL CREATE [TEMP] TABLE CREATE [TEMP] TABLE
AS
AS IMPORT() CREATE FUNCTION [ NAME ] CREATE KEYWORD [ NAME ] CREATE OPERATOR [ NAME ] CREATE TYPE [ NAME ] DELETE FROM
[] DROP TABLE [IF EXISTS]
DROP FUNCTION DROP KEYWORD DROP OPERATOR DROP TYPE INSERT [INTO]
[] VALUES LOAD SELECT SELECT [] [ ORDER BY ocol1 [ASC|DESC], ... ocolN [ASC|DESC]] ] [ GROUP BY gcol1 [, ... gcolN] ] [ LIMIT [start,] length ] UPDATE
SET [] B NATURAL, INNER, OUTER, LEFT, RIGHT, FULL B * Aggregate : MIN, MAX, AVG, SUM, COUNT * Date/Time : CURRENT_DATE, CURDATE, CURRENT_TIME, CURTIME, CURRENT_TIMESTAMP, NOW, UNIX_TIMESTAMP * String : ASCII, CHAR, BIT_LENGTH, CHARACTER_LENGTH, CHAR_LENGTH, COALESCE, NVL, IFNULL, CONV, CONCAT, DECODE, HEX, OCT, BIN, INSERT, LEFT, RIGHT, LOCATE, POSITION, LOWER, UPPER, LCASE, UCASE, LTRIM, RTRIM, OCTET_LENGTH, REGEX, REPEAT, REPLACE, SOUNDEX, SPACE, SUBSTITUTE, SUBSTRING, SUBSTR, TRANSLATE, TRIM, UNHEX * Numeric : ABS, CEILING, CEIL, FLOOR, ROUND, EXP, LOG, LN, LOG10, MOD, POWER, RAND, SIGN, SQRT, TRUNCATE, TRUNC * Trig : ACOS, ACOSEC, ACOSECH, ACOSH, ACOT, ACOTAN, ACOTANH, ACOTH, ACSC, ACSCH, ASEC, ASECH, ASIN, ASINH, ATAN, ATAN2, ATANH, COS, COSEC, COSECH, COSH, COT, COTAN, COTANH, COTH, CSC, CSCH, DEG2DEG, DEG2GRAD, DEG2RAD, DEGREES, GRAD2DEG, GRAD2GRAD, GRAD2RAD, PI, RAD2DEG, RAD2GRAD, RAD2RAD, RADIANS, SEC, SECH, SIN, SINH, TAN, TANH * System : DBNAME, USERNAME, USER B * IMPORT - imports a table from an external RDBMS or perl structure * RUN - prepares and executes statements in a file of SQL statements B = , <> , < , > , <= , >= , IS [NOT] (NULL|TRUE|FALSE) , LIKE , CLIKE , IN , BETWEEN B and B * regular identifiers are case insensitive (though see note on table names) * delimited identifiers (inside double quotes) are case sensitive * column and table aliases are supported B * use either ANSI SQL || or the CONCAT() function * e.g. these are the same: {foo || bar} {CONCAT(foo,bar)} B * comments must occur before or after statements, cannot be embedded * SQL-style single line -- and C-style multi-line /* */ comments are supported B * currently NULLs and empty strings are identical in non-ANSI dialect. * use {col IS NULL} to find NULLs, not {col=''} (though both may work depending on dialect) See below for further details. =head2 Syntax - Details =head3 CREATE TABLE Creates permanent and in-memory tables. CREATE [TEMP] TABLE ( ) CREATE [TEMP] TABLE AS will be evaluated the same as C