Designing, viewing and testing an SQL statement

Designing the SQL statement

There are three basic components to designing the SQL statement:

    1. Working with tables

      This includes adding tables to the query, creating joins between tables, setting aliases for tables, and displaying the data type of each field in the tables.  For more information, see Working with tables.

    2. Setting query properties

      This is where you choose the overall type of SQL statement for this query – SELECT, INSERT, UPDATE or DELETE.

      For SELECT statements, you can specify the DISTINCT and/or TOP parameters.  For INSERT, UPDATE or DELETE statements, you can specify which table will be modified.

      For more information, see Setting query properties.

    3. Working with columns

      At a minimum, a SELECT query must specify one or more columns (or fields) to display in the query result set.  However, you can create more sophisticated queries by setting an alias for a column, setting a sort order for the results, introducing grouping or aggregate functions, and hiding some columns or values from the result set.

      For INSERT and UPDATE queries, you must specify new data values to be added to the table.

      For SELECT, UPDATE, and DELETE queries, you may want to add criteria for a column.  This criteria can help to determine which records will be returned by a SELECT statement, modified by an UPDATE statement, or removed by a DELETE statement.

      For more information, see Working with columns.

Viewing the SQL statement

At any time while using the SQL Statement Design screen to create an SQL statement, you may view the SQL statement created by the contents of this screen.  For more information, see Viewing the SQL statement.

Testing the SQL statement

There are two ways to test your SQL statement from the SQL Statement Design screen:

Note:  Use caution when testing an INSERT, UPDATE, or DELETE query.  If the query can be processed without errors, it will modify the contents of the specified table.

For more information, see Testing the SQL statement.

Accepting the finished SQL statement

After you have successfully created an SQL Statement on the SQL Statement Design screen, click Save to paste it into the SQL statement box on Step 2 of the Database Integration Wizard.

 

More:

Working with tables

Setting query properties

Working with columns

Viewing the SQL statement

Testing the SQL statement

Database Integration Wizard: Step 2