Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Teradata RDBMS forUNIX SQL Reference - NCR

NCR Teradata RDBMS forUNIX SQL Reference - NCR, 1997. - 913 p.
Download (direct link): teradataforunix1997.pdf
Previous << 1 .. 6 7 8 9 10 11 < 12 > 13 14 15 16 17 18 .. 241 >> Next


For example, string ‘TEST’ where each letter is represented as double byte letter will be represented as TEST. Occasionally, when encoding is important, we will indicate hex representation. For example, the following mixed single byte/multibyte character data in KanjiEBCDIC character set

LMN<TEST>QRS

is represented as:

D3 D4 D5 0E 42E3 42C5 42E2 42E3 0F D8 D9 E2

Note: KatakanaEBCDIC uppercases single byte data.

Refer also to the Glossary and Acronyms sections in the Preface of this manual for further explanation of terms used.

Note

Throughout this manual and other Teradata manuals, the term “Japanese character site”, or “Japanese character supported site”, implies and is the same as a “Kanji feature site”.

1-8

Teradata RDBMS for UNIX SQL Reference
Data Handling Fundamentals

Chapter 2

Data Handling Fundamentals

Teradata RDBMS for UNIX SQL Reference
Data Handling Fundamentals

Teradata RDBMS for UNIX SQL Reference
Data Handling Fundamentals About This Chapter

About This Chapter

This chapter covers the following topics:

• Standard form for data in the Teradata RDBMS

• Using partial names

• Basic data manipulation

• Data definition statements

• SQL requests

• Data Manipulation Language (DML)

• Default database

• Macros

• Subqueries

• Supported characters

• Operations on null

• Statement response

• Session parameters

Teradata RDBMS for UNIX SQL Reference

2-1
Data Handling Fundamentals

Standard Form for Data in the Teradata RDBMS

Standard Form for Data in the Teradata RDBMS

Data is stored in the Teradata RDBMS according to the relational model, which is based on tables with rows and columns. Each row of a table is composed of a number of fields identified by column name. Each field contains a data item with a single data type.

A database consists of a collection of related tables. The rows of a table can be considered an unordered set.

The form for referencing a column is:

A fully qualified name consists of a database name, a table name, and a column name.

For example, a fully qualified reference for the Name column in the Employee table is:

Personnel.Employee.Name

An asterisk references all columns in a row simultaneously, for example,

SELECT * FROM Employee;

references the following columns:

Personnel.Employee.EmpNo

Personnel.Employee.Name

Personnel.Employee.DeptNo

Personnel.Employee.JobTitle

Personnel.Employee.Salary

Personnel.Employee.YrsExp

Personnel.Employee.DOB

Personnel.Employee.Sex

Personnel.Employee.Race

Personnel.Employee.MStat

Personnel.Employee.EdLev

Personnel.Employee.HCap

columnname

I— databasename.

HH01A101

2-2

Teradata RDBMS for UNIX SQL Reference
Data Handling Fundamentals Using Partial Names

Using Partial Names

A partial name is a table or column reference that is not fully qualified. For example, “DeptNo” is a partial name.

Teradata SQL allows you to omit database names and table names in referencing columns as long as the reference is not ambiguous.

For example, the WHERE clause in the following statement:

SELECT Name, DeptNo, JobTitle FROM Personnel.Employee WHERE Personnel.Employee.DeptNo=100 ;

can be written as:

WHERE DeptNo=100 ;

because the database name and table name can be derived from the “Personnel.Employee” reference in the FROM clause.

Also, “Personnel” may be omitted if you have established Personnel as the default database. A default database is established via the DATABASE option in a CREATE USER or MODIFY USER statement, and can be changed during a session by executing a DATABASE statement.

Note: An ambiguous partial name results in an error.

The following principles govern name resolution:

Name Resolution AT , „

• Name resolution is performed statement by statement.

• When an INSERT statement contains a subquery, names are resolved in the subquery first.

• Names in a view are resolved when the view is created.

• Names in a data manipulation statement (SELECT, INSERT, UPDATE) contained in a macro, are resolved when the macro is created.

• Names in a data definition statement (CREATE or REPLACE) contained in a macro, are not resolved until the macro is executed, and resolution uses the default database of the user submitting the EXECUTE statement. It is therefore recommended that all names in a data definition statement contained in a macro, be fully qualified.

Teradata RDBMS for UNIX SQL Reference

2-3
Data Handling Fundamentals

Basic Data Manipulation

Teradata SQL Statement Syntax

Statement Punctuation

Basic Data Manipulation

A typical SQL statement consists of a statement keyword, one or more column names, a database name, a table name, and one or more optional clauses introduced by keywords. As an example, in the following single-statement request:

SELECT deptno, name, salary FROM personnel.employee WHERE deptno IN(100, 500)
Previous << 1 .. 6 7 8 9 10 11 < 12 > 13 14 15 16 17 18 .. 241 >> Next