Construct an SQL Statement page

Use the pages on this notebook page to create the SQL statement.

The pages that are included on this notebook page of the wizard depend on the type of statement that you are creating.
Statement type Pages that are included
SELECT and SELECT DISTINCT Tables, Columns, Joins, Conditions, Groups, and Order
INSERT Tables and Insert
UPDATE Tables, Update, and Conditions
DELETE Tables and Conditions
Tables
Use this page to select the one or more tables to use in the SQL statement. The fields that are on this page depend on the type of SQL statement that you are creating.
Available Tables
Expand a schema, click one or more tables to use in the SQL statement, and then click >. If you are creating an INSERT, UPDATE, or DELETE statement, you can select only one table. If you are creating a SELECT or SELECT DISTINCT statement, you can select multiple tables. Use the Ctrl and Shift keys to select multiple tables.
Selected Tables
Shows the tables that you have selected for the SELECT or SELECT DISTINCT statement.
Tables
Shows the name of a selected table. To remove a table from this list, click it, and then click <. To remove all the tables, click <<.
Alias
Use this cell to specify a substitute name for a table in a SELECT or SELECT DISTINCT statement. Double-click the cell, and then type the table alias.
Selected Table
Shows the table that you have selected for the INSERT, UPDATE, or DELETE statement. To remove the table from this field, click it, and then click <.
Columns
Use this page to select the columns to use in the SQL statement.
Available Columns
Expand a table, click the columns to use in the SQL statement, and then click >. Use the Ctrl and Shift keys to select multiple columns. To add all the columns in all of the tables that are in the list, click >>.
Selected Columns
Shows the columns that you have selected and the expressions that you have defined for the SQL statement. To add an expression to the list, click Add, and then use the Expression Builder wizard to create the expression. To change an expression, click it in the list, and then click Change. To remove an expression from the list, click it, and then click Remove.
Columns
Shows the name of a selected column or expression. To remove a column from this list, click it, and then click <. To remove all the columns, click <<. To change the placement of a column or expression in the list, click the column and then click Move Up or Move Down.
Alias
Use this cell to specify a substitute name for a column or an expression. Double-click the cell, and then type the alias.
Show schema and table names
If this check box is selected, the column names in the Selected Columns list are fully qualified by their schema and table names.
Joins
Use this page to specify the join conditions to join tables.
unlabeled field
This pane graphically shows the tables and columns that you selected for the SQL statement. To specify a join condition, do one of the following:
  • Drag the pointer from a column in one table to a column in another table. To change the join type from the default inner join, right-click the join connection and then click Specify Join Type on the pop-up menu. Select the join type in the Specify Join window.
  • Right-click a table, and then click Create Join on the pop-up menu. Specify the join condition in the Create Join window.
Conditions
Use the grid on this page to specify the conditions that control which rows of the database to select, update, or delete, depending on the type of statement that you are creating. The conditions for an SQL statement are specified in a WHERE clause or a HAVING clause.
Column
This column can contain either a table column or an expression. To enter an expression, click Build Expression in the list, and then use the pages of the Expression Builder wizard to specify the expression.
Operator
Select an operator for the condition.
Value
This column can contain a column, value, or expression. Double-click the cell and type a value, select a column, or click Build Expression to open the Expression Builder wizard.
AND/OR
If you need multiple conditions in the WHERE clause, select either AND or OR as the logical connective between each condition.
Groups
Use this page to specify the information for a GROUP BY clause in a SELECT statement. The GROUP BY clause specifies that rows that are retrieved by the WHERE clause should be grouped and condensed in such a way that all rows having the same values for the grouping columns are treated as a single row in the result set.
unlabeled field
Shows the list of grouping expressions that are currently defined. Initially, this list contains only the default Grouping root.
Type
Shows the grouping type for the selected grouping expression.
Column
Shows the columns, expressions, and grouping types that are defined for the selected grouping expression. To add a new element, double-click the first empty row, and then select a column or grouping type, or click Build Expression and create an expression.
Order
Use this page to specify the columns to use to order the rows in the results table. You can specify the sort order for each column.
Available Columns
Expand a table, click the columns to use to order the rows in the results table, and then click >. You can use the Ctrl and Shift keys to select multiple columns. To add all the columns in all of the tables that are in the list, click >>.
Display output columns only
Select this option to show only the columns in the results table in the Available Columns list. Use the Columns page to specify which columns appear in the results table.
Display all available columns
Select this option to show all columns in all tables in the Available Columns list.
Selected Columns
Column
Shows the name of the columns in the order in which their values are sorted in the results table. To change the placement of a column in the list, click the column, and then click Move Up or Move Down.
Sort Order
Specifies whether the values in the column are sorted in ascending or descending order. The sort order defaults to ascending.
Show schema and table names
If this check box is selected, the column names in the Selected Columns list are fully qualified with their schema and table names.
Insert
Use this page to specify the values for the new row that you want to insert in the table that you selected on the Tables page.
Column
Shows the name of a column in the table.
Type
Shows the data type and size of the column.
Value
Type a value for the column in the new row of the table. If the name in the Column cell is preceded by a + character, you must supply a value for the column.
Update
Use this page to specify the values for the columns that you want to update in the table that you selected on the Tables page.
Column
Shows the name of a column in the table.
Type
Shows the data type and size of the column.
Value
Type a value for the column in the new row of the table.
Related information
Creación de archivos SQLJ
Creación de procedimientos almacenados

Comentarios