Chapter 2 Physical Data Model Basics


Defining queries with the SQL Editor

You can use the editing features of the SQL Editor to define a query. The SQL Editor dialog box is divided into specific panes containing the information shown below:

Information Pane location
Objects types Upper left part of the dialog box
Available objects Upper right part of the dialog box
Query script textbox Lower part of the dialog box

The list of available objects depends on the selected object type. You can select individual objects from the list of available objects for insertion in the query script textbox.

You can also define expressions by entering basic arithmetic operators such as add, subtract, multiply, divide (+, -, *, /) and with the syntax tools shown below:

Syntax tool Content
Functions Provides group, number, string, date, conversion and other functions
Operators Provides logical operators
Variables Provides variables for use with operators and functions
Macros Provides macros to accelerate the creation of a template item definition

These syntax tools allow greater flexibility in defining complex expressions.

The SQL Editor can be used for the following tasks:

For more information on defining views, see Defining a query for a view in chapter Building Physical Diagrams.

For more information on defining computed columns, see Creating a computed column in chapter Building Physical Diagrams.

Steps To define a query with the SQL Editor:

  1. Click the query script textbox where you want to insert the SQL script.
  2. Select an object type from the upper left part of the dialog box.

    For example, select Tables to display the list of available tables. The list of available objects of this type appears in the upper right part of the dialog box.
  3. Double-click the available object that you want to add to the script.

    The item is added to the query script.
  4. Select a function or an operator to add to the script from the Function or Operator dropdown listboxes.

    The item is added to the query script.
  5. Click OK.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.