16.20 - Using Code Completion - Teradata SQL Assistant

Teradata® SQL Assistant for Windows User Guide

Product
Teradata SQL Assistant
Release Number
16.20
Published
October 2018
Language
English (United States)
Last Update
2020-01-03
dita:mapPath
gfk1537201040714.ditamap
dita:ditavalPath
ft:empty

SQL Assistant can provide suggestions for the object and built-in function names that can be used.

A drop-down list might appear after you type any of the following delimiter characters: space, comma, tab, ||, arithmetic symbols, or comparison symbols.

As you continue to enter the object name, the first item to match is selected in this list. When the item you want is selected, type one of the delimiter characters or press Enter to select and insert that name into your query.

You can type an open parenthesis to accept and insert any function name that requires parenthesis. Only an open parenthesis or the Enter key will accept and insert such a function.

You can close the list by pressing ESC.

Code completion only appears after the keywords and delimiters used within the common Select, Insert, Update and Delete statements are typed, and after the space following Create, Alter, Drop, Modify, Replace, Show, Help and Database keywords. To display a selection list when you have not typed one of the delimiter characters, press Ctrl+Space.

Code completion works differently in SQL Assistant than in other editors. SQL Assistant uses the concept of a current database. Initially, the current database is set to the default database for the data source. Change this setting by right-clicking on a database in the Database Explorer tree and selecting Use for View Names.

When the FROM clause is entered, the suggestion list contains all the views, and (optionally) the tables, in the current database in addition to all the databases currently in the Database Explorer tree under this data source.

SQL Assistant also builds an active list. Each time table or view name in the FROM clause is entered, that object along with any alias name is added to the active list. When entering the Select and Where clauses, these alias names and the columns contained in the objects within the active list appear.

Because objects and their columns are not added to the active list until they have been entered in the FROM clause, type the FROM clause before the remainder of the statement.

The active list continues to grow as additional Select statements or sub-selects are entered. This means that you do not need to enter the FROM clause of your second statement before other parts of the statement if your previous statements referenced the same tables. However, if you switch to a completely different set of tables and views, reduce the size of the drop-down lists by clearing out the active list by right-clicking on the data source in the Database Explorer tree and selecting Clear Column List.

If you use the Teradata form of the FROM clause (a simple comma-separated list), the last name in the list is not be added to the active list unless you press Ctrl+Shift+Space after the last View/alias name or type the start of the Where clause.