Home

 

Creating SQL statements

You can create an SQL statement by using the SQL builder or the SQL editor in the Data perspective.

The SQL editor supports any statements that can be run by the database to which you are connected. You can create single or multiple SQL statements, single or multiple XQuery statements, XQuery statements that are nested in SQL statements, and SQL statements that are nested in XQuery statements. The SQL editor provides features such as multiple statement support, syntax highlighting, content assist, query parsing, and validation.

The SQL builder provides a graphical interface for creating and running SQL statements. Statements that are generated by the SQL builder are saved in a file with the extension .sql. The SQL builder supports creating SELECT, INSERT, UPDATE, DELETE, FULLSELECT, and WITH (DB2 only) statements.

In this section, we create and run an SQL query to retrieve a customer name based on the social security number, and the total amount of money involved in each transaction type (credit, debit). The SQL select statement includes table aliases, table joins, a query condition, a column alias, a sort type, a database function expression and a grouping clause.

ibm.com/redbooks