Академический Документы
Профессиональный Документы
Культура Документы
To become an 'ANSI-standard' language, all vendors of SQL must become certified in ANSI (American National Standards Institute) standards by the NIST (National Institute of Standards and Technology), a government certification agency. There are three ANSI standards: ANSI SQL - 89 (SQL 1) ANSI SQL - 92 (SQL 2) ANSI SQL - 99 (SQL 3)
There are three levels of compliance within each level: ANSI SQL - 92 (SQL 2) Entry level Intermediate level Full level
Teradata SQL is an ANSI compliant product. Teradata has its own extensions to the language, as do most vendors. Teradata SQL is fully certified at the SQL92 Entry level, with some intermediate, some full and some SQL-99 Core features also implemented. As the Teradata database evolves, each major release is expected to move Teradata SQL closer to conformance with full SQL2, and including some features from the SQL3 standard.
Modes of Operation
Teradata SQL allows two different modes of session operation: ANSI mode Teradata (BTET) mode
Choice of mode affects: Transaction protocol behavior Case sensitivity defaults Collating sequences Data conversions Display functions
Be aware that the same SQL statement might perform differently in each mode based on the above considerations. Regardless of the mode you select, all syntax, whether or not ANSI compliant, is useable. No functionality is inhibited by choice of mode.
Example (Note: all user input commands are in red.) .SET SESSION SQLFLAG ENTRY; .LOGON xyz,xyz; sel date; *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second. sel date; $ *** SQL Warning 5836 Token is not an entry level ANSI Identifier or Keyword. sel date; $ *** SQL Warning 5821 Built-in values DATE and TIME are not ANSI. sel date; $ *** SQL Warning 5804 A FROM clause is required in ANSI Query Specification. (Note that three warnings were generated because ANSI does not accept lowercase characters, abbreviations, or the DATE keyword. In spite of the warnings, the date is returned.) Date -------97/01/20
(Note that we must logoff in order to reset the ANSI Flagger.) .LOGOFF; .SET SESSION SQLFLAG NONE; .LOGON xyz,xyz; sel date; *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second.
Date -------97/01/20
Note: SQLFLAG may also be set when using Teradata front-end clients other than BTEQ, for example the Teradata Preprocessor (PP2) and the Call Level Interface (CLIv2).
[SET] SUPPRESS [SET] TDP [SET] TITLEDASHES And, it is 6 7 8 9. [SET] UNDERLINE [SET] WIDTH
= = = ON for
OFF ALL l5442 ON for the normal report. results of WITH clause number: 1 2 3 4 5
= OFF ALL = 75
Example
HELP 'SQL SELECT'; /* Provides syntax help for the SQL SELECT statement */ HELP 'SQL ALTER TABLE'; /* Provides syntax help for SQL ALTER TABLE statement */ HELP also provides syntax help for most Teradata client utilities as well as for SQL.
Example
HELP 'utilityname utilitycommand'; such as: HELP 'ARCHIVE Command-name'; HELP 'MULTILOAD command-name';
HELP Examples
HELP either generates a list of all available commands and functions, as in: HELP 'SQL'; *** Query completed. 35 rows found. One column returned. *** Total elapsed time was 1 second. On-Line Help (Partial Listing) -------------------------------------------------------------------
---DBS SQL COMMANDS: ABORT BEGIN TRANSACTION STATISTICS COMMIT DATABASE CREATE INDEX CREATE USER DELETE USER DROP DATABASE DROP TABLE STATISTICS ECHO TRANSACTION EXECUTE GRANT ALTER TABLE CHECKPOINT COMMENT CREATE MACRO CREATE VIEW DELETE DATABASE DROP INDEX DROP VIEW END LOGGING EXPLAIN GRANT LOGON BEGIN LOGGING COLLECT CREATE CREATE TABLE DATABASE DELETE DROP MACRO DROP END GIVE HELP
or, delivers the full syntax for any specified command, such as: HELP 'SQL UPDATE'; *** Query completed. 10 rows found. One column returned. *** Total elapsed time was 1 second. On-Line Help -------------------------------------------------------------------------UPD[ATE] tablename [ [AS] aname ] [ FROM tname [ [AS] aname] ] [... ,tname [ [AS] aname ] ] ; SET columnname = expr [ ... ,columnname = expr] [ WHERE condition ] [ ] ; [ ALL ]