You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

The quickest way to create a SELECT is to drop a column, table, view or alias into the [Select] Deck. Once items are in the [Select] Deck you can drag to rearrange their order within the select statement created in the SQL Pane. Items dragged to the left appear first in SQL statements in the SQL Pane. If an Alias is present in the [Select] Deck an Alias Icon appears on its right side to make distinguishing Aliases from unaliased objects easier.

Query Builder - Select

Column Expressions

To create a Column Expression in the [Select] Deck, right click on a column within it and select [Function]. You will see a list of the available functions such as [AVG, COUNT, COUNT_BIG, MAX, MIN] and [SUM]. This list of functions varies based on the vendor and version of database you are connected to. If you choose [COUNT], you notice that the column name changes in the Select Deck to reflect the Function that has been selected. It will appear as COUNT(column_you_dragged).

Query Builder - Select - Column Expression

You can create your own Custom Column Expression by selecting [Functions > Custom Expression] and typing the Expression and providing an Alias name for it. If you have [Query > Quote Identifiers] selected, then the SQL Pane will show your table and column surrounded by quotes.

Aliases

It's possible to make an Alias from any item in the [Select] Deck by right clicking it and choosing [Create Alias...]

Query Builder - Select - Create Alias

After entering the text for your Alias and clicking [OK], the item name will change to display the Alias text you used. The Alias Icon will appear to its right. The SQL Pane reflects the Alias use in your SELECT statement as well.

Query Builder - Column Alias

You can determine an Alias's origin by mouse hovering the item and viewing its tooltip details.

Left clicking the menu triangle in the [Select] Deck allows you to Create SQL Expressions, Create Subqueries, choose [DISTINCT] or [ALL] (or other options depending on vendor), [Clear the Select Deck] of all items, [Select All] items on the [Select] Deck or [Hide] the deck.

Query Builder Select Menu

SQL Expressions

Choosing [Create SQL Expression...] from the [Select] Deck menu triangle...

Query Builder - Select - SQL Expression Menu Choice

generates the [SQL Expression] Dialog, allowing you to write out your own SQL Expression.

Query Builder - Select - SQL Expression Dialog

Any expressions you type in the [Select] Deck [SQL Expression] Dialog appear as items in the Select Deck. Mouse hover over an Expression in the [Select] Deck produces a tooltip letting you know what the Expression contents are.

Query Builder - Select - SQL Expression in Deck

SQL Expressions can be created in the Query Builder in a variety of other ways.  

  • You can click the menu triangle (or right click) in an object in the [Select] Deck and choose [Functions > Expression] and type your expression.
  • When dropping a column into the [Where] or [Having] Deck you can click the [Expression] radio button in the [Criteria] Dialog and type your expression.
  • You can also click the menu triangle (or right click) for a preexisting item in the [Where] or [Having] Deck and click the [Expression] radio button to type your expression.
  • When a JOIN exists you can click its icon to edit its Join Properties, then click [Edit] under the [Expression] section to type your expression.



  • No labels