SQL Pane

The SQL pane displays the SQL statement for the current query. As you build your query, the SQL pane is automatically updated and reformatted to be easy to read.

In the SQL pane you can:

  • Create new queries by entering SQL statements.

  • Modify the SQL statement created by the Query Designer based on settings you make in the Diagram and Grid panes.

  • Enter statements that take advantage of features specific to the database you are using.

Note   Be sure you know the rules for identifying database objects in the database you are using. For details about SQL Server, see Query Designer Considerations for SQL Server Databases.

Statements in the SQL Pane

You can edit the current query directly in the SQL pane. When you move to another pane, the Query Designer automatically formats your statement, and then changes the Diagram and Grid panes to match your statement.

Note   You can enter optimizer hints for SQL statements, but the Query Designer might reformat them. For details about SQL Server, see Query Designer Considerations for SQL Server Databases.

If your statement cannot be represented in the Diagram and Grid panes, and if those panes are visible, the Query Designer displays an error and then offers you two choices:

  • Return to the SQL pane and edit the statement.

  • Discard your changes and revert to the most recent version of the SQL statement.

If you return to the SQL pane and continue editing the statement, the Query Designer dims the other panes to indicate that they no longer reflect the contents of the SQL pane.

You can also use the SQL pane to enter SQL statements that cannot be represented graphically in the Query Designer. In such cases, the Query Designer displays the same behavior as it does when it detects an error — it dims the Diagram and Grid panes to indicate that they do not represent the current statement. You can continue to edit the statement and execute it as you would any SQL statement. For details about unsupported query types in SQL Server, see Query Designer Considerations for SQL Server Databases.

Note   If you enter an SQL statement, but then make further changes to the query by changing the Diagram and Grid panes, the Query Designer rebuilds and redisplays the SQL statement. In some cases, this action results in an SQL statement that is constructed differently from the one you originally entered (though it will always yield the same results). This difference is particularly likely when you are working with search conditions that involve several clauses linked with AND and OR.

See Also

Creating Queries | Designing Queries | Diagram Pane | Executing a Query | Grid Pane | Results Pane | Using Expressions in a Query