Accessing Any Database - Interactive Teradata Query Facility

Interactive Teradata Query User Guide

Interactive Teradata Query Facility
Release Number
English (United States)
Last Update
Product Category
Teradata Tools and Utilities

Normally, you are in your own user database when you first log on to the Teradata Database System (Teradata DBS). For example, if your Teradata DBS user name is “Jones”, you can access any object in the Jones user space without “qualifying” the object names; that is, without preceding the object name with the name of its owning database.

However, you can access the objects of any database on which you have at least the SELECT privilege by qualifying the name of the object in your query. For example, the following request qualifies the Employee table name:

SELECT * FROM Personnel.Employee;

You can set any database to which you have access privileges as your “default” database; that is, the database whose objects you can query without qualifying the object name.

The system administrator can set a “permanent” default by specifying the DEFAULT option in the CREATE/MODIFY USER statement. This is the database you can query without qualifying object names as soon as the session begins.

Any time during a session, you can use the Teradata SQL DATABASE statement to reset your default to any other database on which you have access privileges. For example, if you want to set your default for this session to the Personnel database, enter the following:

DATABASE Personnel;

When the statement is accepted, you can access any of the tables in the sample Personnel database (Employee, Department, Charges, and Projects; see Appendix A) without qualifying the table name.

For example, you should now receive a valid return from the request:

SELECT * FROM Charges;

The rest of the examples in this guide assume you have established Personnel as your default database for the current session.