Teradata Studio Features

Embed Size (px)

Citation preview

  • 8/18/2019 Teradata Studio Features

    1/46

     

    Teradata Studio Features Page 1

    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 ©2007–2015. All Rights Reserved. 

  • 8/18/2019 Teradata Studio Features

    2/46

     

    Page 2 Teradata Studio Features

     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 

  • 8/18/2019 Teradata Studio Features

    3/46

     

    Teradata Studio Features Page 3

    Optimize EffectivenessTeradata 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 operatingsystems. 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 TeradataAdministrator. It can also replace 3

    rd 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

     

  • 8/18/2019 Teradata Studio Features

    4/46

     

    Page 4 Teradata Studio Features

    Key FeaturesTeradata Studio combines ease of use and automation elements of Teradata Database

    architecture and features to provide the most efficient environment to deploy, no matter howmany applications or subject areas you have.

    Teradata Studio is a query tool written for relational database developers. It is intended for SQL- proficient 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 user-defined 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, user-

    defined 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 AsterDatabases 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.

  • 8/18/2019 Teradata Studio Features

    5/46

     

    Teradata Studio Features Page 5

    Studio and Studio Express:

    • Modular display

    • Connection Profile Wizard

    • Data Source Explorer 

    • Teradata View

    • SQL Editor 

    • SQL parses, annotations, content

    assist, and SQL templates (for

    Teradata and Aster)

    • Result Set Viewer 

    • SQL History

    • SQL Query Builder 

    • Data Wizard

    Teradata Studio only:

    • Create and modify dialogs

    • Copy objects

    • Compare objects

    • Move space

    • Find objects

     

  • 8/18/2019 Teradata Studio Features

    6/46

     

    Page 6 Teradata Studio Features

    Modular DisplayThe 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 Explorerwill 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 isexecuted, 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 actionsthat 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. Studiosupports moving, hiding, docking and detaching the different panel views. Panels can be moved

     by dragging the panel’s tab to any edge of the Studio window.

  • 8/18/2019 Teradata Studio Features

    7/46

     

    Teradata Studio Features Page 7

    Teradata View

    Studio Toolbar 

    Project Explorer 

    SQL Editor 

    Data Source Explorer 

    Teradata SQL History

    Teradata Result Set Viewer 

     

  • 8/18/2019 Teradata Studio Features

    8/46

     

    Page 8 Teradata Studio Features

     Teradata Studio ToolbarTeradata 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 SQLfiles.

    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 Auto-

    activation. 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 orusers, 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 Profilesand 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 thespecific object affected by the rights or privileges.

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

    • 

    Navigation Toolbar  – The Navigation toolbar buttons are used to reference locationswithin 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 menuitems 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 backto its previous display.

  • 8/18/2019 Teradata Studio Features

    9/46

     

    Teradata Studio Features Page 9

    File Actions Toolbar

    SQL Tools Toolbar 

    Data Tools Toolbar 

    Artifact Maintenance Toolbar 

    Create/Modify Actions Toolbar

    Security Toolbar

    Find Actions Toolbar

    Navigation Toolbar

  • 8/18/2019 Teradata Studio Features

    10/46

     

    Page 10 Teradata Studio Features

    Data Source Explorer ViewSelecting 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:

    •  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

  • 8/18/2019 Teradata Studio Features

    11/46

     

    Teradata Studio Features Page 11

    The Data Source Explorer View

    panel contains the database

    object tree display.

    It is here that you can create

    connection profiles to yourTeradata Database systems

    and interact with the database

    objects.

     

  • 8/18/2019 Teradata Studio Features

    12/46

     

    Page 12 Teradata Studio Features

    Creating ConnectionsWhen 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 tochoose 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 throughoutthe 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 anexternal file. The external file is called jdbcConnectionProperties.properties and located in

    the workspace .metadata/Teradata directory. The jdbcConnectionProperties.properties fileallows 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 listof 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.

  • 8/18/2019 Teradata Studio Features

    13/46

     

    Teradata Studio Features Page 13

    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.

    Click New Connection Profile

     

  • 8/18/2019 Teradata Studio Features

    14/46

     

    Page 14 Teradata Studio Features

    Creating Database ObjectsBefore 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 tofamiliarize the student with these objects.

    On the following page we begin by showing how one can use either the tool’s Data SourceExplorer 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 accessedfrom 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 fromthe context menu.

    The Data Source Explorer feature of Teradata Studio displays an alphabetical listing of databasesand 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 adatabase 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 user’s default database

    •  The database "DBC"

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

    •  Columns and indexes of tables

    •  Columns of views

    •  Parameters of macros

    •  Parameters of stored procedures

  • 8/18/2019 Teradata Studio Features

    15/46

     

    Teradata Studio Features Page 15

    1. Right click on tables folder 

    2. Click on Teradata

    3. Click on Create Table

     

  • 8/18/2019 Teradata Studio Features

    16/46

     

    Page 16 Teradata Studio Features

    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 typesfor 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 thegenerated 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 lowerleft-hand corner will open the Help context for the dialog.

  • 8/18/2019 Teradata Studio Features

    17/46

     

    Teradata Studio Features Page 17

    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

    9. Select SQL Review

    4

    5

    67

    8 9

     

  • 8/18/2019 Teradata Studio Features

    18/46

     

    Page 18 Teradata Studio Features

    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 SQLstatements 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 SourceExplorer, 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 informationon 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 querycan be executed at a time.

  • 8/18/2019 Teradata Studio Features

    19/46

     

    Teradata Studio Features Page 19

    Click SQL Editor icon to open the editor to start

    Execute

    Execute Parallel

     

  • 8/18/2019 Teradata Studio Features

    20/46

     

    Page 20 Teradata Studio Features

    Project Explorer ViewThe 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 canalso 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 whencomparing 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, rightmouse click

    and select

    Execute

     

  • 8/18/2019 Teradata Studio Features

    21/46

     

    Teradata Studio Features Page 21

    HELP TABLE CommandThe 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 viathe 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 Treeinformation on table

    Employee

    Cursor on column

    Last_Name shows

    hidden information

    Result of HELP

    TABLE command on

    table Employee

    SQL Request

     

  • 8/18/2019 Teradata Studio Features

    22/46

     

    Page 22 Teradata Studio Features

    Other SQL HELP CommandsThe 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 usingSQL 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.

  • 8/18/2019 Teradata Studio Features

    23/46

     

    Teradata Studio Features Page 23

    Databases and Users:

    HELP DATABASE Employee_Sales;

    HELP USER Dave_Jones;

    Database Objects:HELP TABLE Employee;

    HELP VIEW Emp_Views.emp;

    HELP MACRO payroll_3;

    HELP COLUMN Employee_Sales.employee.last_name;

    HELP INDEX employee;

    HELP STATISTICS employee;

    HELP CONSTRAINT employee.over_21;

    HELP VOLATILE TABLE vol_tab1;

    HELP JOIN INDEX Employee_Sales.Employee;

    HELP HASH INDEX Employee_Sales.Department;

    HELP TRIGGER trigger1;

    HELP PROCEDURE proc1;

    HELP FUNCTION func1;

    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.

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

     

  • 8/18/2019 Teradata Studio Features

    24/46

     

    Page 24 Teradata Studio Features

    Setting a Default DatabaseAs seen on the previous slide, knowing which database is your default is an important concept –

    that is, if you don’t want to spend a substantial amount of time always qualifying databases andtables.

    To avoid always having to qualify objects you can set a single default database that will allowyou 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 bethe 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 defaultdatabase if your user was created from our standardized script. Or it may have been changed by

    your DBA.

    CREATE USER abc ASPERM = 1000000,PASSWORD = lucky,DEFAULT DATABASE = Emp_Views;

    On the next frame, the new default database will be Employee_Sales.

  • 8/18/2019 Teradata Studio Features

    25/46

     

    Teradata Studio Features Page 25

    Logged on as user 

    Default database

    Changes the

    default database to

    Employee_Sales.

    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.

    Clicking on “SQL

    Statement” in Historywill 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;

     

  • 8/18/2019 Teradata Studio Features

    26/46

  • 8/18/2019 Teradata Studio Features

    27/46

     

    Teradata Studio Features Page 27

    Other SQL SHOW CommandsOther 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 usedfor 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.

    Database Objects:

    SHOW TABLE Employee;

    SHOW VIEW Emp_Views.emp;

    SHOW MACRO payroll_3;

    SHOW TRIGGER Employee_Sales.trig1;

    SHOW PROCEDURE proc1;

    SHOW FUNCTION func1;

    Some other SQL SHOW commands.

    Discuss the various

    levels of qualification

    shown on the right.

    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.

     

  • 8/18/2019 Teradata Studio Features

    28/46

     

    Page 28 Teradata Studio Features

    Session Information via SELECTThe 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. Theseare 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 accountinformation 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 Session Number Database Default Logon Account String

     

  • 8/18/2019 Teradata Studio Features

    29/46

     

    Teradata Studio Features Page 29

    Session Information via HELP SESSIONThe HELP SESSION command may be used to provide more information about a session than

    what we’ve seen previously with by using Session variables. Included in this single row resultare 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 AdvancedSQL, 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.

     

  • 8/18/2019 Teradata Studio Features

    30/46

  • 8/18/2019 Teradata Studio Features

    31/46

  • 8/18/2019 Teradata Studio Features

    32/46

     

    Page 32 Teradata Studio Features

    SQL Editor with Outline ViewThe 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 tobe highlighted.

     

  • 8/18/2019 Teradata Studio Features

    33/46

     

    Teradata Studio Features Page 33

    Using SQL Query BuilderQuery 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 iscomplex 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.

     

  • 8/18/2019 Teradata Studio Features

    34/46

     

    Page 34 Teradata Studio Features

    Result Set ViewerThe 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 andtriggers. 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 hideor 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 associatedwith 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

     

  • 8/18/2019 Teradata Studio Features

    35/46

     

    Teradata Studio Features Page 35

    SQL History ViewThe 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, databaseserver, 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 thehistory 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

    To open previous SQL statements in the SQL Editor 

    Tool Options

     

  • 8/18/2019 Teradata Studio Features

    36/46

     

    Page 36 Teradata Studio Features

     Teradata ViewThe 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

     

  • 8/18/2019 Teradata Studio Features

    37/46

     

    Teradata Studio Features Page 37

    Shortcuts to Data Source ObjectsWith 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 “Showdatabase and Users in Hierarchical display” in preference.

    Window - Preferences - Teradata Datatools Preferences - Data Source Explorer LoadPreferences 

    Hierarchical Format Unchecked

     

  • 8/18/2019 Teradata Studio Features

    38/46

     

    Page 38 Teradata Studio Features

    Shortcuts to Typing Object NamesFor 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 youin the typing of queries whether lengthy or short.

    Click and Drag from here to there.

     You can drag objects from the Data Source Explorer to the Scrapbook to

    have the full name added quickly.

     

  • 8/18/2019 Teradata Studio Features

    39/46

     

    Teradata Studio Features Page 39

    Commenting Lines of SQLThe 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 alsocomment ending portions of a SQL request like this.

    HELP DATABASE DBC; - - this is a comment  

    Note how the SQL

    Editor color codes the

    lines of code.

    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”) 

     

  • 8/18/2019 Teradata Studio Features

    40/46

     

    Page 40 Teradata Studio Features

    Logging on to Multiple SystemsThe next frame illustrates how to log on to multiple Teradata systems in the same instance.

    Note the two

    explorer tree

    references.

    One for each

    system.

    Note

     

  • 8/18/2019 Teradata Studio Features

    41/46

     

    Teradata Studio Features Page 41

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

    Load Data. 

    Load and extract data to andfrom tables

    • Over 100k uses Fastload

    protocol

    • Under 100k uses batch

    protocol

     

  • 8/18/2019 Teradata Studio Features

    42/46

     

    Page 42 Teradata Studio Features

    Choosing Studio or Studio ExpressTeradata Studio Family Users

    Teradata Studio Express Teradata Studio ExpressTeradata Studio Ultimate

    (TBD)

    •  Business Users

    • 

    Ad-hoc Type Queries

    Users

    •   Novices

    •  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 definedfunctions, 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

  • 8/18/2019 Teradata Studio Features

    43/46

     

    Teradata Studio Features Page 43

    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.

     

  • 8/18/2019 Teradata Studio Features

    44/46

     

    Page 44 Teradata Studio Features

     The Employee_Sales DatabaseThe 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 youreference the correct column and table names for the lab exercises.

    The Employee_Sales database contains all tables referenced by the lab exercises.

    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.

    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.

     

  • 8/18/2019 Teradata Studio Features

    45/46

     

    Teradata Studio Features Page 45

     The Emp_Views DatabaseThe 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 youreference the correct column and table names for the lab exercises.

    The Emp_Views database contains all views referenced by the lab exercises

    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.

    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.

     

  • 8/18/2019 Teradata Studio Features

    46/46

     

    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).