Teradata SQL Statements and Requests - Interactive Teradata Query Facility

Interactive Teradata Query User Guide

Product
Interactive Teradata Query Facility
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2452
Product Category
Teradata Tools and Utilities

A Teradata SQL “request” is one or more Teradata SQL statements that are submitted as a single unit of work. A request is considered complete, or terminated, when either the “End of Text” character or the request “terminator” is encountered. The request terminator is a semicolon that is the last non-blank character on an input line. (A request terminator is optional except when the request appears within a Teradata SQL macro or is entered through ITEQ.)

A single-statement request consists of a solitary statement. For example:

SELECT * FROM Personnel.Employee;

A multi-statement request consists of two or more statements separated by semicolons. For example, this statement:

INSERT INTO TestDB.TA (Name) VALUES (’NameA’)
; SELECT * FROM TestDB.TA;

and this statement:

INSERT INTO TestDB.TA (Name) VALUES (’NameA’)
; SELECT * FROM TestDB.TA;

are both multi-statement requests. The first semicolon is a statement separator and the second semicolon is a request terminator.

Teradata SQL statements are used to:

  • Define data: create, alter, modify, or drop databases and their objects (tables, views, and macros).
  • Manipulate data: insert, update, or delete the contents of tables and views.
  • Select data: query the contents of tables and views.
  • Create, modify, or drop macros: stored sequences of Teradata SQL statements that are executed as a single operation.
  • Control data: create, modify, or drop user space; grant or revoke access privileges on user space and databases.
  • For detailed information on the structure of Teradata SQL requests and the syntax of each Teradata SQL statement, refer to SQL Fundamentals (B035-1141).