When users negotiate a successful logon to Teradata, they
are automatically positioned in a default database as defined by the database
administrator. When an SQL request is executed, by default, it looks in the
current database for all referenced objects.
There may be times when the object is not in the current
database. When this happens, the user has one of two choices to resolve this
situation. One solution is to qualify the name of the object along with the
name of the database in which it resides. To do this, the user simply
associates the database name to the object name by connecting them with a
period (.) or dot as shown below:
<database-name>.<table-name>
The second solution is to use the database command. It
repositions the user to the specified database. After the database command is
executed, there is no longer a need to qualify the objects in that database. Of
course, if the SQL statement references additional objects in another database,
they will have to be qualified in order for the system to locate them.
Normally, you will DATABASE to the database that contains most of the objects
that you need. Therefore it reduces the number of object names requiring
qualification.
The following is the syntax for the DATABASE command.
DATABASE <database-name>
;
If you are not sure what database you are in, either the
HELP SESSION or SELECT DATABASE command may be used to make that determination.