The Query Builder enables you to create a query without writing or editing SQL statements. Even if you are familiar with SQL, the graphical interface makes it easier to create relationships and visualize the query.
Note: This procedure does not cover all of the possible steps of visually building a query. It only covers the steps required to build a query for the scenario.
Scenario Your company wants to improve its global sales, starting with countries where it has a customer base but generally low sales. You need to create a query that identifies countries with less than $500,000 in sales for each of the last four fiscal years. Note: This scenario uses the SH (Sales History) sample schema that comes with Oracle 10g so you can follow the procedure. |
To visually build a query based on this scenario
Drag the following tables from the Object Explorer to the Diagram pane: TIMES, SALES, CUSTOMERS, and COUNTRIES.
Tips:
Table |
Column |
---|---|
COUNTRIES | COUNTRY_NAME |
TIMES | FISCAL_YEAR |
SALES | AMOUNT_SOLD |
Tips:
Select the Aggregate Function field in the AMOUNT_SOLD column and select Sum. This sums all of the sales per fiscal year per country.
Note: If you select a group by clause or aggregate function for a column, the rest of the columns in the query must also have a group by clause or aggregate function.
Select 2001 in the second Constant field and click OK.
Note: The SH schema does not have current data. The 1998-2001 years provide the best data for the purposes of this scenario.
Click .
The query results display in the Results tab. See View Result Sets for more information.
To save the query, right-click the Query Builder tab and select Save File.
You can save a query and any results sets in a Toad editor file (.tef). This file format is useful for building scripts that have large result sets that you do not want to continue executing or for saving results when you have not finished building a script.
See Tutorial: Build a Subquery for a tutorial on creating a subquery.
See Add Subqueries for more information on how to add a subquery.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Nutzungsbedingungen Datenschutz Cookie Preference Center