You are on page 1of 46

Appendix

Teradata Studio Features


After completing this module, you should be able to:
Logon and use Teradata Studio to submit SQL to Teradata.
Use the Data Source Explorer GUI to drill-down into database object
information.
Apply basic settings to Teradata Studio for tailoring its usage.
Compare and contrast certain Teradata Studio features with SQL
alternatives like HELP, SHOW, Session/System Variables.

Teradata Corporation Copyright 20072015. All Rights Reserved.

Teradata Studio Features

Page 1

Table of Contents
Optimize Effectiveness ....................................................................................................................3
Key Features ....................................................................................................................................4
Modular Display ..............................................................................................................................6
Teradata Studio Toolbar ..................................................................................................................8
Data Source Explorer View ...........................................................................................................10
Creating Connections.....................................................................................................................12
Creating Database Objects .............................................................................................................14
Creating Database Objects (continued) .........................................................................................16
Creating a SQL Statement (SQL Editor) .......................................................................................18
Project Explorer View ...................................................................................................................20
HELP TABLE Command ..............................................................................................................21
Other SQL HELP Commands .......................................................................................................22
Setting a Default Database.............................................................................................................24
The Teradata SHOW Command ................................................................................................26
Other SQL SHOW Commands ......................................................................................................27
Session Information via SELECT .................................................................................................28
Session Information via HELP SESSION .....................................................................................29
SQL Editor .....................................................................................................................................30
SQL Editor with Outline View ......................................................................................................32
Using SQL Query Builder .............................................................................................................33
Result Set Viewer ..........................................................................................................................34
SQL History View .........................................................................................................................35
Teradata View ................................................................................................................................36
Shortcuts to Data Source Objects ..................................................................................................37
Shortcuts to Typing Object Names ................................................................................................38
Commenting Lines of SQL ............................................................................................................39
Logging on to Multiple Systems....................................................................................................40
Teradata Load Wizard ...................................................................................................................41
Choosing Studio or Studio Express ...............................................................................................42
The Employee_Sales Database ......................................................................................................44
The Emp_Views Database .............................................................................................................45
Summary ........................................................................................................................................46

Page 2

Teradata Studio Features

Optimize Effectiveness
Teradata Studio is a client-based graphical interface used to perform Teradata database
administration, external data access and query tasks. Teradata Studio is built on the Eclipse
Rich Client Platform (RCP), taking advantage of the RCP framework for building and deploying
native GUI applications. It extends the Eclipse Data Tools Platform (DTP) to enhance Teradata
Database access. Teradata Studio can be run on Windows, Linux, and Mac OSX operating
systems. The Eclipse platform is designed as an open tools platform but architected so that its
components (or a subset of its components) can be used to build RCP applications. This allows
Teradata Studio to benefit from the many high quality Eclipse features available while focusing
on value-add for Teradata.
Teradata Studio is designed to replace Teradata Index Wizard, Teradata Statistics Wizard,
Teradata Visual Explain, Teradata System Emulation Tool, SQL Assistant, and Teradata
Administrator. It can also replace 3rd party products such as AquaFold (Aqua Data Studio) and
Quest (TOAD). Teradata Studio has these advantages over those products:

Simpler installation and setup process


Intuitive, simpler and customizable user interface
Supported by more operating systems than just Windows
Improved performance with large data

Teradata Studio is a client-based graphical interface used to perform


Teradata database administration, external data access and query tasks.
Built on the Eclipse Rich Client Platform (RCP)
Build and deploy native GUI applications
Extends the Eclipse Data Tools Platform (DTP) to enhance Teradata
Database access
Open tools platform
Components can be used to build RCP applications
Many high quality Eclipse features available
Operating systems that Teradata Studio supports:
Windows
Linux
Mac OSX

Teradata Studio Features

Page 3

Key Features
Teradata Studio combines ease of use and automation elements of Teradata Database
architecture and features to provide the most efficient environment to deploy, no matter how
many applications or subject areas you have.
Teradata Studio is a query tool written for relational database developers. It is intended for SQLproficient developers who know how to formulate queries for processing on Teradata or other
ODBC-compliant Databases. Used as a discovery tool, Teradata Studio catalogs submitted
instructions to arrive at a derived answer.
Teradata Studio delivers the following capabilities.

Create databases, users, tables, views, stored procedures, user-defined functions and userdefined types.
Display information about databases, users, tables, views, macros, stored procedures,
user-defined functions and user-defined types.
Modify and drop databases and users.
Administer roles and profiles.
Grant or revoke access and system rights.
Manage privileges on database objects.
Copy table, view, stored procedure, macro or user-defined type definitions to another
database, or to another system.
Drop or rename tables, views, stored procedures, macros or user-defined functions.
Move space from one database to another.
Modular display that allows you to move panels around, creating a custom look and feel.
Data Source Explorer:
View database objects, such as databases, tables, macros, stored procedures, userdefined functions, user-defined types, views, and triggers.
Menu options to run stored procedures, macros, and user-defined functions.
Find objects.
Use Connection Profile Wizard to create connection profiles using the Teradata JDBC
driver.
Create, modify, format and execute SQL queries against both the Teradata and Aster
Databases through SQL Editor.
Maintain a historical record of submitted queries with timings and status information.
Export result sets to Excel, XML or text files.
Import external data from Excel, .csv and Hadoop HDFS into data labs.
Setup the rules for query and access logging.

For administrative functions, Teradata Studio will provide a preview of the SQL statements and
allow the user to save the SQL to a file or display it in the SQL Editor.

Page 4

Teradata Studio Features

Studio and Studio Express:

Teradata Studio only:

Modular display

Create and modify dialogs

Connection Profile Wizard

Copy objects

Data Source Explorer

Compare objects

Teradata View

Move space

SQL Editor

Find objects

SQL parses, annotations, content


assist, and SQL templates (for
Teradata and Aster)
Result Set Viewer
SQL History
SQL Query Builder
Data Wizard

Teradata Studio Features

Page 5

Modular Display
The Teradata Studio display includes the Teradata Studio Toolbar along with six view panels:

Data Source Explorer contains the database object tree display. It is here that you can
create connection profiles to your Teradata Database systems and interact with the
database objects.

Project Explorer provides a hierarchical view of the Projects and their resource files.
It is here that you can select SQL files for editing or create new SQL files.

SQL Editor displayed when a SQL file is opened. Initially, the SQL Editor is opened
to provide an area to enter SQL statements. The user must provide a connection profile
in order to execute the SQL statements. Double clicking on a file in the Project Explorer
will cause the file to be opened in the SQL Editor View.

Teradata SQL History contains the results when executing SQL statements and
running database routines, user-defined functions, and triggers. Each time SQL is
executed, the command is saved in the History window. This allows you to run them
again.

Teradata View displays detailed information about database object. Click the
Teradata View so that it is in focus. Then select an object from the Data Source Explorer
and detailed information about that object is displayed in the Teradata View.

Teradata Result Set Viewer displays the result set data. Individual Result Set tabs are
created for each result set. The Result Set Viewer also contains a toolbar with actions
that can occur on the result set data, such as saving, exporting, or printing the result set
data.

You can rearrange the various panels and windows to fit your workflow preferences. Studio
supports moving, hiding, docking and detaching the different panel views. Panels can be moved
by dragging the panels tab to any edge of the Studio window.

Page 6

Teradata Studio Features

Studio Toolbar
Project Explorer
SQL Editor
Data Source Explorer
Teradata SQL History
Teradata Result Set Viewer
Teradata View

Teradata Studio Features

Page 7

Teradata Studio Toolbar


Teradata Studio contains a toolbar that provides buttons to allow quick access to dialogs for
creating database objects or invoking functions that are used while creating and modifying SQL
files.
Teradata Studio toolbar is divided into the following sections:

File Actions Toolbar The File Actions toolbar buttons are used when editing a SQL
file. They include Save, SaveAs, Cut, Copy, Paste, Undo, Redo, Print, and Show
Whitespace.

SQL Tools Toolbar The SQL Tools toolbar buttons are used to perform actions on the
SQL statements within the SQL Editor. They include Execute as Individual Statements,
Execute as One Statement, Explain, Format, Prompt for Notes, Code Assist Autoactivation. SELECT Statement and SHOW DDL are activated when a table is selected in
the DSE.

Data Tools Toolbar The Data Tools toolbar buttons provide actions that are performed
on a database table, such as Show Row Count, FastLoad and FastExport.

Artifact Maintenance Toolbar The Artifact Maintenance toolbar buttons provide


actions to Move Space from one database to another, Copy and Compare objects,
Rename objects, Drop objects and Delete databases.

Create/Modify Actions Toolbar The Create/Modify Actions toolbar buttons provide


actions to create or modify database objects, such as creating or modifying databases or
users, creating tables, views, stored procedures, macros, triggers, and user defined types.
Note: User defined types are created in the SYSUDTLIB database.

Security Toolbar The Security toolbar buttons provide actions to administer Profiles
and Roles, as well as grant and revoke Rights and Privileges. Administer Profiles, Roles,
Logon Rights, and Connect Through Rights is activated from the Database node at the
top of the Data Source Explorer tree. Other rights and privileges are activated from the
specific object affected by the rights or privileges.

Find Actions Toolbar The Find Actions toolbar provides quick access to the Find
Object and Find Next Object.

Navigation Toolbar The Navigation toolbar buttons are used to reference locations
within the SQL file. They include Next Annotation, Previous Annotation, and Last Edit
Location.

A view can also contain its own toolbar and drop down menu. These toolbar buttons and menu
items provide actions on the data managed by the view. Included in the view toolbar are buttons
to minimize, maximize, and restore the view. Maximizing the view will cause the view to take
over the entire Teradata Studio window display. Click the Restore button to return the view back
to its previous display.
Page 8

Teradata Studio Features

File Actions Toolbar


SQL Tools Toolbar
Data Tools Toolbar
Artifact Maintenance Toolbar
Create/Modify Actions Toolbar
Security Toolbar
Find Actions Toolbar
Navigation Toolbar

Teradata Studio Features

Page 9

Data Source Explorer View


Selecting folders or objects in the Data Source Explorer will enable the buttons in the toolbar or
menu options. For example, selecting a database object will enable these functions:

Page 10

Move Space
Copy/Compare Objects
Drop
Create Database
Create User
Modify Database
Create Procedure
Create Macro
Create View
Privileges
Column Rights
Create Authorization
Access Logging
Query Logging
System Rights
Administer Logon Rights
Administer Connect Through Rights

Teradata Studio Features

The Data Source Explorer View


panel contains the database
object tree display.
It is here that you can create
connection profiles to your
Teradata Database systems
and interact with the database
objects.

Teradata Studio Features

Page 11

Creating Connections
When you start Teradata Studio, you will be prompted for a connection. In our case, we will
start by selecting the Teradata Database.
You can create connections to your database using the Connection Profile Wizard. The wizard is
invoked from the Data Source Explorer by right clicking on the Database Connections folder.

Create connection profiles using the Teradata JDBC driver


LDAP, Kerberos, stored password optional

Teradata Studio provides an option to create connection profiles for additional database servers
other than Teradata. You must provide the specific database server JDBC drivers for databases
other than Teradata.
The Connection Profile Wizard is based on a driver template that references an embedded
Teradata JDBC driver. Enter the database server name, user name, password, and default
database name into the wizard dialog screen. The Authentication Mechanism allows you to
choose an advanced logon mechanism, such as LDAP or Kerberos, or select the default
mechanism, PASSWORD_PROTECTED. If you wish to save your password to disk, check the
Save Password box. Otherwise, the password is stored in the profile and only active throughout
the Teradata Studio session. When Teradata Studio is closed, the unsaved password is removed
before the profile is written to disk. You will be prompted for the password the next time you
connect to that profile.
Optionally, you can choose a different Teradata JDBC driver than the embedded Teradata JDBC
driver. You can also add or remove the JDBC properties, as well as save the properties to an
external file. The external file is called jdbcConnectionProperties.properties and located in
the workspace .metadata/Teradata directory. The jdbcConnectionProperties.properties file
allows you to share a set of JDBC properties with other Teradata Studio users. If the file exists
when creating a new Teradata connection profile, it will load those property values into the list
of JDBC connection properties. If the file exists but it is empty, the connection wizard will
assume that no JDBC properties are specified and the Teradata JDBC driver will use the default
settings.

Page 12

Teradata Studio Features

Click New Connection Profile

Or right click on the Database


Connections folder to create a
new connection.
Select Teradata Database from
the Connection Profile Types,
enter a Name and click Next.
Use the server name, user
name and password supplied
by your instructor.

Teradata Studio Features

Page 13

Creating Database Objects


Before we begin writing SQL, it would be useful to get familiar with the databases, tables, and
views we will be referencing. This page will be the first in a series of pages that attempts to
familiarize the student with these objects.
On the following page we begin by showing how one can use either the tools Data Source
Explorer or SQL to retrieve names (table names, view names, etc.) for the objects residing in a
database or user. Recall that both Databases and Users are repositories for tables and other
objects, only a user has a logon. To better understand this difference, compare the minimum
syntax needed to create each:
To create a database:
CREATE DATABASE abc AS PERM = 1000000;
To create a user:
CREATE USER abc AS PERM = 1000000, PASSWORD = lucky;
You can easily create database objects using the Teradata Studio dialogs. Dialogs are accessed
from the Teradata Studio Tools toolbar or via the Data Source Explorer context menus. For
example, to create a new Table, expand the Databases folder and locate the database you wish to
create the table in. Right click on the Tables folder and select Teradata, then Create Table from
the context menu.
The Data Source Explorer feature of Teradata Studio displays an alphabetical listing of databases
and objects of the connected user. It further permits drilldown on individual objects to views,
column names, indexes and parameters as they apply. This is simply done by clicking on a
database name to expand the tree display for that database. It can help reduce the time required
to build a query and help reduce errors in object names.
Initially, the following Teradata databases are loaded into the Data Source Explorer:

The User ID that was used to connect to the database


The users default database
The database "DBC"

The Data Source Explorer allows you to drill down to show:

Page 14

Columns and indexes of tables


Columns of views
Parameters of macros
Parameters of stored procedures

Teradata Studio Features

1. Right click on tables folder


2. Click on Teradata
3. Click on Create Table

Teradata Studio Features

Page 15

Creating Database Objects (continued)


The Create Table dialog will appear. First, enter your column information. Enter a column
name and select the column type. The drop down list will present the list of valid column types
for the Teradata version you are creating your table in. Click Apply to add the column to the list
of columns. Click New to create another column definition. Next, choose the Primary Key,
Indexes, and Foreign Keys for the table. Lastly, select the SQL Preview tab to view the
generated SQL. Click Run SQL to execute the CREATE TABLE statement. This will create
the table in the database and cause the Tables folder in the Data Source Explorer to be refreshed.
For additional help using a Teradata Studio dialog, clicking the question mark (?) at the lower
left-hand corner will open the Help context for the dialog.

Page 16

Teradata Studio Features

4. Enter column name


5. Select column type
6. Click Apply
7. Click New to repeat

8. Choose the
Primary Key,
Indexes, and
Foreign Keys for
the table

4
5

9. Select SQL Review

Teradata Studio Features

Page 17

Creating a SQL Statement (SQL Editor)


When Teradata Studio is launched, a SQL Editor area is provided for you to enter your SQL
statements. Once you have a connection to your Teradata database, you can begin to enter SQL
statements in the SQL Editor window. Click the Save button to save the SQL Editor to a file.
Another option to create a SQL file is through the Data Source Explorer. Within the Data Source
Explorer, select your database connection and click the SQL Scrapbook action from the Data
Source Explorer toolbar. This will create a SQL file in the SQL Editor with the name SQL
Scrapbook [n] and the connection profile set to your database connection. You are now ready
to enter your SQL statement. Refer to the section below entitled SQL Editor for information
on executing your SQL statement. Click the Save icon to save your SQL file within your SQL
Project.
Queries are created by simply typing in the query text into the SQL Editor. It is not necessary to
add a semi-colon at the end of a command. However, a semicolon between the statements is
required for two or more statements. The query may be executed by clicking on the Execute
icon in the toolbar. This icon looks like a pair of footprints.
Execute actually executes the statements in the query one statement after the other and
optionally stops if one of the statements returns an error.
Execute Parallel executes all statements at the same time and is only valid if all the
statements are Teradata SQL/DML statements. This submits the entire query as a single request,
allowing the database to execute all the statements in parallel. Multiple answer sets are returned
in the Result Set Viewer window.
Once this option is selected, you may open additional tabs in the query window. Each tab can
contain a separate query, and any of these queries can be executed. However, only one query
can be executed at a time.

Page 18

Teradata Studio Features

Click SQL Editor icon to open the editor to start

Execute
Execute Parallel

Teradata Studio Features

Page 19

Project Explorer View


The Project Explorer View panel provides a hierarchical view of the Projects and their resource
files. It is here that you can select SQL files for editing or create new SQL files. SQL files can
also be imported from or linked to your file system. When Teradata Studio is first installed, an
initial project called SQL is created for you. You can create additional projects using the New
> Project... menu option.
Within the Project Explorer, you can also choose an option to compare two files. The Compare
Option displays the two files side by side with buttons that allow you to jump from one
difference to another or move changes from one file to another. This is very handy when
comparing SQL files or result set data.
The Project Explorer also provides an option to execute one or more SQL files from list of files.

To execute a
script, right
mouse click
and select
Execute

Page 20

Teradata Studio Features

HELP TABLE Command


The next frame shows two methods for retrieving column information on tables. The
information retrieved via the SQL request syntax is more informative than for that retrieved via
the Data Source Explorer. And because it is SQL, the result appears in the Results Window.
The Data Source Explorer requires only pointing and clicking as is expected from a GUI tool.
Also, more information can be viewed by either moving the cursor arrow onto a column, or by
dragging the edge of the Data Source Explorer window to the right.

The HELP TABLE command returns information about a database or user object.
Qualifications for SQL are databasename.tablename.columnname

Explorer Tree
information on table
Employee

SQL Request

Cursor on column
Last_Name shows
hidden information
Result of HELP
TABLE command on
table Employee

Teradata Studio Features

Page 21

Other SQL HELP Commands


The HELP commands shown on the next frame are ways to retrieve information on other objects
in a database or user. An important aspect to remember when retrieving any information using
SQL is that of which database owns the object.
In some examples the database name is specified into the SQL request in other cases it is not.
The reason for this has to with something called your default database. Your default is shown
in Teradata Studio along a banner near the top portion of the tool. If the object you are
referencing exists in this database, there is no need to reference (qualify) it in your SQL. If it
does not exist in this database, then it must be referenced in the SQL request.
Default databases are discussed in the frame after this one.

Page 22

Teradata Studio Features

Some other SQL HELP commands.


Discuss the various
levels of qualification
shown on the right.

For a complete list of


HELP objects, issue the
following:
HELP 'SQL HELP';
We will take a closer look
at this special syntax in a
later module.

Databases and Users:


HELP DATABASE
HELP USER

Employee_Sales;
Dave_Jones;

Database Objects:
HELP TABLE
HELP VIEW
HELP MACRO
HELP COLUMN
HELP INDEX
HELP STATISTICS
HELP CONSTRAINT
HELP VOLATILE TABLE
HELP JOIN INDEX
HELP HASH INDEX
HELP TRIGGER
HELP PROCEDURE
HELP FUNCTION

Employee;
Emp_Views.emp;
payroll_3;
Employee_Sales.employee.last_name;
employee;
employee;
employee.over_21;
vol_tab1;
Employee_Sales.Employee;
Employee_Sales.Department;
trigger1;
proc1;
func1;

The three different levels for referencing objects are: Database, Table and Column.

Teradata Studio Features

Page 23

Setting a Default Database


As seen on the previous slide, knowing which database is your default is an important concept
that is, if you dont want to spend a substantial amount of time always qualifying databases and
tables.
To avoid always having to qualify objects you can set a single default database that will allow
you to refrain from having to qualify that database name for objects referenced or owned by that
database. You may have only one default set at any time, and this default may be set using SQL
at any time during your session. Once invoked, this new default remains until it is changed
again, or until you log off. Each time you log on to the Teradata your default database will be
the same. This default need not be your own user name. It can be set to something other than
your user name when your user was created.
If you recall, the minimum syntax required to create a user is:
CREATE USER abc AS PERM = 1000000, PASSWORD = lucky;
The default database for this user will be its own user (username is the default). It could have
been set to another database if this syntax were used to create abc. This would be your default
database if your user was created from our standardized script. Or it may have been changed by
your DBA.
CREATE USER abc AS
PERM = 1000000,
PASSWORD = lucky,
DEFAULT DATABASE = Emp_Views;
On the next frame, the new default database will be Employee_Sales.

Page 24

Teradata Studio Features

The default database assignment remains for a session until it is changed.


The original logon default is acquired again at next logon.
Mouse-over the top of the Explorer Tree, as shown below, to display these defaults.
Logged on as user

Default database

Changes the
default database to
Employee_Sales.

Clicking on SQL
Statement in History
will recall it to the Query
Window later.

After issuing the database default request shown,


which database will be checked for the following?
HELP TABLE Employee;

Teradata Studio Features

Page 25

The Teradata SHOW Command


The next frame contrasts the result of the SHOW command with similar information provided by
the Teradata Studio Data Source Explorer.
Note how the result of the SHOW command appears in the result window whereas the result of
the right-click show definition method would display the result into the Query Window
(not shown). Except for the location of the result, they display the same information. The nice
thing about the Data Source Explorer method is that one can easily make changes and create
another unique table from an existing table without having to copy from the Results Window to
the Query Window.
The definition shown includes any syntax acquired during the initial create by default and not by
explicitly typing the syntax itself. For example, what were likely not included during the initial
creation of the table were references to the following.

Set (do not store duplicate rows in this table vs. multiset allow duplicate rows)
(Permanent) Journaling references
Fallback
Character Set Latin
Not Case Specific
Checksum

There are default options for these settings and were likely obtained by these defaults.

The SHOW command may be used to provide the definition of an object.


In this example, we are getting the definition for a table in database
Employee_Sales.
Once the
command is
executed, the
result will appear
in the Result Set
panel.

Double Click to
open in a new
window. This
allows for
copying the text.

Page 26

Teradata Studio Features

Other SQL SHOW Commands


Other SHOW commands are shown on the next frame. Although the HELP commands are more
plentiful than are those for the SHOW command, the SHOW command displays the syntax used
for creating the object, and can provide much more information about the object. The definition
shown includes any syntax acquired during the initial create by default and not by explicitly
typing the syntax itself.

Some other SQL SHOW commands.


Discuss the various
levels of qualification
shown on the right.

Database Objects:
SHOW TABLE
SHOW VIEW
SHOW MACRO
SHOW TRIGGER
SHOW PROCEDURE
SHOW FUNCTION

Employee;
Emp_Views.emp;
payroll_3;
Employee_Sales.trig1;
proc1;
func1;

For a complete list of objects referenced by the SHOW command you can issue the
following:
HELP 'SQL SHOW';
We will take a closer look at this special syntax in a later module.

Teradata Studio Features

Page 27

Session Information via SELECT


The next frame shows how you can obtain information about your current session by using a
SELECT statement to project values found in session variables relating to your session. These
are sometimes referred to as built-in functions. Regardless, they are keywords. The more
important of these values are likely to be those returned from USER and DATABASE. Those
for ACCOUNT and SESSION are likely to be more important to DBAs since account
information is tied closely to your request priority, while session (more specifically session
number) can be joined to other dictionary tables for providing more information about your
user. Joins will be discussed later.
A brief description follows:
USER Who you are logged on as.
DATABASE Your active or current database default.
ACCOUNT The account information associated with your logon.
SESSION The session number for your current session.

One method for retrieving information about your current session is to reference the
session variables below. (These are sometimes referred to as Built-in Functions)
The SELECT is the main focus of the next module.
Logon User

Page 28

Session Number

Teradata Studio Features

Database Default

Logon Account String

Session Information via HELP SESSION


The HELP SESSION command may be used to provide more information about a session than
what weve seen previously with by using Session variables. Included in this single row result
are the values shown on the previous page, namely:

USER Who you are logged on as.


ACCOUNT Your account information.
DATABASE Your current default database.

Other valuable information includes:

LOGON DATE
LOGON TIME
TRANSACTION SEMANTICS

For a complete list of values, feel free to issue this command during a lab. Much of the
information displayed from using this statement is described in other courses such as Advanced
SQL, Physical Implementation, and Application Design and Development.

Another method for listing session information is to issue the request shown below.
Note that the scroll bar indicates more information is available for viewing.

Teradata Studio Features

Page 29

SQL Editor
The SQL Editor view is displayed when a SQL file is opened. Double clicking on a file in the
Project Explorer will cause the file to be opened in the SQL Editor.
The SQL Editor provides an area for you to enter your SQL statements. As an option, you can
enable the auto activation of code assist by clicking the toolbar button. If this option is enabled,
as you type, SQL code assist will pop up annotations (spellcheck for SQL) showing a list of
expected keywords. If a database name is entered followed by a dot, the content assist will
display the list of tables from your database for you to select from. (Note: By default, auto
activation of code assist is disabled. Also, you must select a Teradata Database connection
profile type in order for SQL code assist to work.)
Code assist will also provide a list of SQL Templates. At the start of the SQL statement, hit the
Ctrl+SPACE keys and a pop up list of templates is displayed. Scroll down until you find the
template you want and double click on it to insert the template into your SQL Editor file.
Anchor statements are provided that you can navigate through by tabbing. You can also edit or
add your own SQL Templates via the SQL Editor Preferences page.
Parameterized queries can also be created in the SQL Editor. The query contains parameters
indicated by question marks. When the query is executed, the user is prompted for the parameter
value(s). Named parameters allow the user to specify a name for the parameter.
The SQL Editor also provides syntax coloring for your SQL statements. You can change the
colors of comments, keywords, identifiers, types, or other syntax items via the SQL Editor
Preferences page.
When right clicking in the SQL Editor window, a SQL Editor Context menu appears with
options to execute the SQL statement(s) in your SQL file.
The following options are presented:

Execute all of the SQL statements


Execute the selected SQL statement
Execute the SQL statements as individual statements (with a commit occurring between
statements)
Execute the selected statement as one statement
Execute the current statement where the cursor is located
Visual Query Builder

Teradata Studio provides a graphical interface for creating SQL statements, referred to as the
SQL Query Builder. You can edit an existing statement using the SQL Query Builder by
selecting the statement within the SQL Editor and choosing the Edit in SQL Query Builder
menu option.

Page 30

Teradata Studio Features

Auto activation

SQL
Editor

Teradata Studio Features

Page 31

SQL Editor with Outline View


The Outline View allows you to select parts of your SQL structure to highlight statements. This
helps with finding groups within nested SQL.

Clicking in the outline panel causes code to


be highlighted.

Page 32

Teradata Studio Features

Using SQL Query Builder


Query Builder provides the user with the ability to use templates for SQL commands, which
may then be modified by the user. This is a convenient way to create commands whose syntax is
complex or not easily remembered. Simply find the appropriate command, then drag and drop it
into the query window where it may then be customized.
The Query Builder window is a floating window you can leave open when you are working
within the main Teradata Studio window.
To access the Query Builder tool, right-click in the Editor and select Edit in SQL Query
Builder from the shortcut menu.
SQL Query Builder provides
the user with the ability to
use templates for SQL
commands.
Right mouse click in the
SQL Editor to open SQL
Query Builder.

Teradata Studio Features

Page 33

Result Set Viewer


The Result Set Viewer displays the result set or parameter data from executing SQL statements
and running database routines, such as stored procedures, macros, user-defined functions and
triggers. The Result Set Viewer provides an enhanced display of the Result Set data. It displays
the result sets as tabs within the Teradata Result Set Viewer, allowing the user to select rows or
cells from the Result Set data table grid. The Result Set Viewer provides menu options to hide
or show all columns, move and sort columns, find a value within the result set data, perform
aggregate functions on selected numeric columns, filter column data, format cells, and copy
cells. Select a row or cell and right click to display the menu options.
Multiple result sets can be displayed as tabs or in a side-by-side sash display.
LOBs (large objects) can also be displayed in the Result Set Viewer. When a query result is
being processed that contains an LOB result column, a dialog appears for the user to specify
where and how to store the LOB values on the file system.
A toolbar is also provided with options to rename the Result Set tab, show the SQL associated
with the result set, switch the display between text and grid display, switch the display between
tabs and side-by-side sash display, and save, export, and print result set data. SQL result data
can also be saved to a file within your Project or exported to an external file in the file system.

Allows the user to select


rows or cells from the Result
Set data table grid
Right click for menu options
Toolbar options are available
as dropdown
Can be exported as:
Excel
XML
Text files

Page 34

Teradata Studio Features

SQL History View


The SQL History View provides an enhanced display of the SQL History information. As SQL
statements are executed from the SQL Editor or functions are run from the Data Source Explorer,
an entry is placed in the SQL History. The SQL History view displays the data in a grid format,
allowing the user to select rows and cells. The SQL History provides extensive information
about the SQL execution, such as execution elapsed time, DBMS time, fetch time, database
server, row count, parameter display for macros and stored procedures, SQL statement, and SQL
statement type. It provides options to copy cells or rows, edit the Note or SQL for a SQL
History entry, search for result history data, and re-execute SQL statements. Choosing the Edit
SQL option will open a SQL Scrapbook file in the SQL Editor with the selected SQL statement.
This allows users to further fine tune their SQL statements.
The SQL History view also provides a toolbar menu with options to delete rows or all of the
history entries, filter columns, format cells and sort columns. The SQL History uses an
embedded Derby Database to manage the SQL History entries.

The SQL History provides extensive information about the SQL execution:
Execution elapsed time
DBMS time
Fetch time
Database server
Row count
Parameter displays
SQL statement
SQL statement type
Tool Options

To open previous SQL statements in the SQL Editor

Teradata Studio Features

Page 35

Teradata View
The Teradata View contains more detailed information about the database objects. When an
object is selected in the Data Source Explorer, it is automatically displayed in the Teradata View.
You can click on the tabs to display additional information on the database object. The Teradata
View toolbar and menu also contains the dialog buttons to create or administer the database
objects.

Databases
Users
Tables
Views
Macros
Stored Procedures
UDFs
User Defined Types
Space and Skew

Detailed information about database objects are displayed automatically

Page 36

Teradata Studio Features

Shortcuts to Data Source Objects


With 14.10, objects are displayed in Hierarchical format, so all the child database can be found
under its parent. If you do not wish to have it in Hierarchical format, uncheck the Show
database and Users in Hierarchical display in preference.
Window - Preferences - Teradata Datatools Preferences - Data Source Explorer Load
Preferences

Hierarchical Format Unchecked

Teradata Studio Features

Page 37

Shortcuts to Typing Object Names


For the next frame, you can drag and drop tables from the Data Source Explorer to the SQL
Editor (Scrapbook) to perform the action shown. This shortcut method can significantly aid you
in the typing of queries whether lengthy or short.

You can drag objects from the Data Source Explorer to the Scrapbook to
have the full name added quickly.
Click and Drag from here to there.

Page 38

Teradata Studio Features

Commenting Lines of SQL


The next frame shows two different techniques you can use to comment lines of SQL.
Commenting lines means they will not be included for execution by the database. You may also
comment ending portions of a SQL request like this.
HELP DATABASE DBC; -- this is a comment

ANSI Standard method


for commenting lines
one at a time.
Teradata method for
commenting blocks of
lines.

Only the highlighted SQL


gets submitted.
(The HELP DATABASE)

Note how the SQL


Editor color codes the
lines of code.

Teradata Studio Features

Page 39

Logging on to Multiple Systems


The next frame illustrates how to log on to multiple Teradata systems in the same instance.

Note the two


explorer tree
references.
Note
One for each
system.

Page 40

Teradata Studio Features

Teradata Load Wizard


In the Data Source Explorer, right mouse click on the table icon and choose Teradata Smart
Load Data.

Load and extract data to and


from tables

Over 100k uses Fastload


protocol
Under 100k uses batch
protocol

Teradata Studio Features

Page 41

Choosing Studio or Studio Express


Teradata Studio Family Users
Teradata Studio Express

Business Users
Ad-hoc Type Queries
Users
Novices

Teradata Studio Ultimate


(TBD)

Teradata Studio Express

DBAs
Power Users
Data Scientists

Enterprise Users
DBAs
Data Scientists

Teradata Studio only:


1. Create and modify dialogs
Create databases, users, tables, views, stored procedures, macros, user defined
functions, and user defined types
Modify and drop databases and users
Administer roles and profiles
Grant or revoke access and system rights
Manage privileges on database objects
Preview of SQL statements
2. Copy objects to another database or another system
Tables
Views
Stored procedures
Macros
User defined type definitions
3. Compare objects from two systems side by side
4. Move space between databases
5. Find objects search for objects within the Data Source Explorer

Page 42

Teradata Studio Features

Studio and Studio Express are very similar with the exception of Studio
having more features than Express. It has:

Administrative Dialogs
Create and Drop Dialogs
Copy and Compare Objects
Hadoop Data Transfer (Smart Loader for Hadoop)
If you don't need those features, Studio Express may be a better fit for you.
Both products are available on the Developer Exchange Download page as
free downloads.

Teradata Studio Features

Page 43

The Employee_Sales Database


The intent of the next frame is to aid you in understanding the objects that will be referenced
during the labs. Keeping the information in the Data Source Explorer can greatly help you
reference the correct column and table names for the lab exercises.
The Employee_Sales database contains all tables referenced by the lab exercises.
Database containing tables
used in the labs.
Note that columns include:
Names
Data Types
NULL/NOT NULL Attributes
Note that index information is
available as well.

The explorer tree diagram on


the right lists all of the tables
used in labs for this course.
Two tables have their
columns listed. These two
tables are very commonly
used.

Page 44

Teradata Studio Features

The Emp_Views Database


The intent of the next frame is to aid you in understanding the objects that will be referenced
during the labs. Keeping the information in the Data Source Explorer can greatly help you
reference the correct column and table names for the lab exercises.
The Emp_Views database contains all views referenced by the lab exercises
Database containing views
used in the labs.
Note that columns include:
Names
Data Types
NULL/NOT NULL Attributes
Note that index information is
not available.

The explorer tree diagram on


the right lists all of the views
used in labs for this course.
For the labs, always check
your default database.

Teradata Studio Features

Page 45

Summary
Characteristics of Teradata Studio include:
Windows-based utility that is used to access any JDBC Compliant
database.
GUI access to the Teradata Dictionary.
SQL commands like SHOW and HELP can also be used to provide
dictionary information.
History can be used to recall a previously issued request to the Query
Window.
Query Builder feature allows for easy creation of SQL statements.
Provides a Data Source Explorer to easily view database objects.
Remember:
You must always be mindful of the current database default setting.
A database default is set via a SQL request.
There are two databases used for labs: Employee_Sales (tables) and
Emp_Views (views).

Page 46

Teradata Studio Features

You might also like