When the SQL Template panel clauses needed for a query are copied to the EDITOR panel, a template for the new query exists. The next step is using the EDITOR to alter the template and type in specific table and column names to finish writing the query.
Keywords
The remaining sections in this step discuss creating the clauses selected for the sample query: SELECT, FROM, WHERE, and ORDER BY. The information presented with the tutorial provides a good foundation for creating basic queries.
Very complex queries can be created in the SQL, as well. Further details on creating complex queries appear in the CA Dataquery Reference Guide.
GROUP BY
The GROUP BY clause produces query results where each row in the result table consists of results of mathematical functions applied to a group of data. GROUP BY is only required if you apply mathematical functions to some columns and not others. The report format definitions that are created during execution of a query can provide results similar to GROUP BY and also provide detail rows in the query output; therefore, the sample query and this section do not reference GROUP BY.
Note: For details about this clause, see the CA Dataquery Reference Guide.
Facts
The following outlines general information about writing queries.
It does not matter how many spaces you enter between words in a clause. It also does not matter whether you choose to type your clauses all on one line (if they fit) or arrange them in a list fashion. The examples in this manual show formatted queries with one space between each word because they are easier for most people to read.
The order in which you use SQL keywords is important. If you do not adhere to ordering conventions, the query cannot be understood by CA Dataquery or CA Datacom/DB. For the SQL clauses, use this order:
|
Copyright © 2014 CA.
All rights reserved.
|
|