Understand. Quest Software 3.1
Реклама
Реклама
Understand
Determine the Best Method to Locate Objects
Toad offers a number of features to assist you in locating objects. The following table provides guidelines based on typical use cases:
If you know the....
Column name, but do not know the table name
String of DDL for an object
Dependency for an object
Use this...
Use Object Search
Criteria for excluding objects
Uses and Used By tabs in the Database
Explorer, ,and then drill-down to the object from there
Filter feature in the Object Explorer
Object Explorer
You can view database objects for the current connection with the Object Explorer. This feature is useful for dragging and dropping database objects into an open Editor, Query
Builder, or other document window. Right-click the objects in the Object Explorer to access additional features such as multiple tasks and actions.
To open the Object Explorer
1. Click on the View toolbar.
2. Review the following for additional information:
Schema (first field)
Object Filter
(second field)
Select the schema you want to view. You can filter the list of
schemas that display. See "Filter Databases and Objects"
(page 11) for more information.
You can quickly set a filter in this field. To do so, enter a name or partial name of an object and press ENTER. Any advanced object filters you set display in this field.
You can also perform advanced filtering based on case
sensitivity, statistics, or other options. See "Filter Databases
3
Toad for Data Analysts User Guide
Understand
and Objects" (page 11) for more information.
Tip: You can enable an option to filter using regular expressions in Tools | Options | Explorer | General.
Note: For tables and views, the columns, data types, and comments display at the bottom of this window.
Tips: l
To navigate to a previously selected object, click . You can also click to the next selected object.
to move l
To locate objects including procedures, functions, views, variable names and
comments in an object's source code, use Object Search. See "Search for Objects"
(page 16) for more information.
l
To use a different method to select objects such as tabs, drop-downs, or a tree view, click .
l
To generate reports, export data, create SQL statements, version control objects, or send objects to the Project Manager, SQL Modeler, or Master Detail windows, rightclick the objects and select an option.
l
To open the Background Processes window and cancel a query, click the progress bar at the bottom of the window.
Filter Databases and Objects
Filters can reduce the number of database and/or objects you have to work with and reduce the amount of time required to query large databases. You can set the following types of filters: l
Quick filter—Applies to the current schema, or objects in the current schema only.
Any unnamed filter you set is in effect the next time you open Toad l
Unnamed filter—Applies to the current schema, or objects in the current schema only.
Any unnamed filter you set is in effect the next time you open Toad.
l
Named filter—Applies to any database connection for the current database provider.
Any named filter you set is in effect the next time you open Toad.
Note: If you rename a table that has a filter defined, it results in an orphaned filter.
Orphaned filters are automatically removed unless you used a tool other than Toad to remove them.
A filter is associated with a specific list of objects from a specific database. Consider the following guidelines when setting filters:
11
Toad for Data Analysts User Guide
Understand
12 l
A filter defined for a set of objects such as tables on one specific database connection does not apply to a list of objects for another database connection.
l
A filter defined for a list of tables on one schema in the database does not apply to the list of tables for a different schema on the same database.
l
A filter set for a specific schema or object is applied when altering objects, using the
SQL Editor, Master Detail Browser, etc., for that schema or object.
Tip: To apply any filters you set to the code completion list in the editor, select the
Apply explorer filters checkbox in Tools | Options | Editor | Code Completion.
To set a quick filter
» Enter text to use for filtering in the field below the database/schema name in the
Object Explorer:
To set a named filter
1. Click beside the database or object field in the Object Explorer.
2. Define criteria for the filter in the Properties tab.
3. Select the SQL tab and select the Enable custom SQL checkbox to create a custom filter based on criteria you specify.
4. Select the Preview tab to view a list of databases or objects that meet your filter criteria before applying the actual filter.
5. Enter a name for the filter if you want to use the filter for other database connections and click .
Icon Description
A filter has not been set so all databases/objects display.
A filter has been set.
Toad for Data Analysts User Guide
Understand
6. If you set a named filter, you can click the arrow beside the icon to apply or remove the filter:
13
Tips: l
To export a named filter or any filters associated with the current connection, click the arrow beside the icon and select Export Filters.
l
To import the filters, select File | Open from the menu.
Click in the Explorer toolbar to clear all database, object, and data filters.
Tutorial: Understand a Table Using the
Database Explorer
Click here to view a video of this feature.
Scenario
You need to build a query listing customers and want to know more about the table before writing the query.
Note: This exercise uses the Toad Sample Database. This connection does not have the relationship and script tabs. The tabs available can differ depending on the type of connection.
Note: This topic focuses on information that may be unfamiliar to you. It does not include all step and field descriptions.
To understand a table using the Database Explorer
1. Connect to the Toad Sample (Access) database in the Navigation Manager.
2. Right-click the CONTACT table and select View Details.
Toad for Data Analysts User Guide
Understand
3. View information for the following: a. Click the Indexes tab and view the index information.
b. Click the Primary Keys and Foreign Keys tabs to view relationships.
4. Click the Data tab.
5. Place the cursor over the LAST_NAME column, click , and select Acton.
14
The only row that now displays is the one with Acton as the last name.
6. Click to the right of the LAST_NAME column again and select All to clear the filter.
7. Click the CONTACT_ID column to sort the rows in ascending or descending order.
8. Click in the top left of the Data tab.
9. Create the following filter in the Where Clause tab:
CONTACT_ID > 2000
The filter string displays at the bottom on the grid. Click to remove the filter.
Toad for Data Analysts User Guide
Understand
10. Select a row of data in the grid. Notice that the row number changes in the bottom right of the status bar:
15
11. Under the SEX column, right-click the area below the last row in the grid that says
"Right-click to add column totals" and select Count. The total number of rows that have either a M or F value display.
12. Click to the right of the SEX column and select F. The count value updates based on the new filter.
13. Click to the right of the SEX column again and select All to clear the filter.
14. Select the SEX column header and drag it the area above the columns that says "Drag a column header here to group by that column":
You can expand each group to view the row data.
15. Switch the default view: a. Right-click within a group or row on the grid and select Show | Card View.
b. Scroll through some records.
c. Click Customize in the Card View window.
d. Click Filter beside the ADDRESS_ID column and select 100. Notice how the card view is filtered, but not the grid view.
e. Close the Card View window.
16. Edit a row: a. Select a row in the FIRST_NAME column and edit the value.
b. Press ENTER to update the row.
Toad for Data Analysts User Guide
Understand
16 c. Go to the BIRTH_DATE column and use the date picker to change the date.
Each data type have an appropriate editor.
Note: If you are using Oracle or a database that does not have auto commit on, you will need to press Commit at the left hand bottom of the window.
17. Update the number of rows in in the data: a. Select Tools | Options | Database | General from the menu.
b. Enter 50 in the Number of rows to initially fetch in data tab.
c. Click OK.
d. Press F5 in the data grid. Notice the bottom right status bar now says "1 of 50
(scroll for more)".
The option you set controls the number of rows fetched in the Data tab.
e. Click the scrollbar and hold down to retrieve more.
f. Right-click the grid and select Read All Rows.
Search for Objects
You can quickly locate an object rather than browsing through a list of objects in the
Database Explorer orObject Explorer. Object Search locates the following: l
Names of objects for a string.
l
Text in objects that include source code, which typically includes procedures, functions, triggers, data types, and views. However, the database provider determines which objects include source code.
l
Variable names and comments in the object's source code.
l
Column names for tables and views.
To search for objects
1. Click on the toolbar (F4).
2. Specify search criteria and click Search.
Note: To append additional search results to the current search, click Append instead.
If you click Search, new results replace the previous search results in the data grid.
Toad for Data Analysts User Guide
Understand
Tips: l
To remove objects from the search results, right-click the objects in the data grid and select Remove Items. This is useful if you want to narrow the list of results to relevant objects.This does not remove the objects from your database.
l
To create a DDL script from the search results, right-click the data grid and select
Create DDL Script. You can then paste the results into the Editor.
l
To perform any actions available for the object, such as creating, altering, dropping, exporting, and generating reports or SQL, right-click the results in the data grid and select an option.
Tutorial: Create a Database Diagram to Use as a
Query Template
Click here to view a video of this feature.
Scenario
Your company creates several daily and weekly reports regarding customer sales. You need to create a Database Diagram that can be used as a template for these queries.
To create a Database Diagram to use as a query template
1. Connect to the Toad Sample (Access) database in the Navigation Manager.
2. Click .
3. Drag the CONTACT table in the Object Explorer to the Diagram pane.
17
Toad for Data Analysts User Guide
Understand
18
4. Right click the Diagram pane and clear Show Dependencies to hide the Referenced
Objects at the bottom of each table/view, as illustrated in the following:
5. Right-click the ORDERS table and select Notes.
6. Enter the following note in the window for other users:
The shipping and billing ADDRESS_ID foreign key relations are not needed in most queries and should be hidden when building a query.
Toad for Data Analysts User Guide
Understand
19
7. Because it is against company policy to display sex and a home phone number in reports, right click on each of these columns in the CONTACT table and select
Hide Column.
Tip: If you have a large number of columns you need to hide, you can right-click a table and select Manage Hidden Columns to quickly select them from a list.
8. Click Add to Project from the wizard bar at the bottom of the window and enter
DBDiagram_Test asthe name for the file. This adds the file to the current project in the Project Manager under a Diagrams folder.
9. Close the Database Diagram window and open the Project Manager window.
10. Expand the Diagrams folder and double-click DBDiagram_Test to reload the file in a new Database Diagram window.
11. To share your project, hidden columns, and notes with colleagues, complete the following: a. Select Tools | Options | Environment | Network Share, and navigate to a shared drive where you want to store the Project Manager file.
b. Select Database | Cache from the open Options window and set the following options:
Object An notation Cache
Share object annotations
Share hidden column settings
Description
Select this checkbox and enter a shared drive location where users can access this file.
Select this checkbox.
c. Provide the location of the Network Share and Object Annotation Cache settings to colleagues who need to use this diagram.
Browse Data in Related Tables
Use the Master Detail Browser to browse data in parent tables and drill-down to data in related child tables. This is useful when you need to analyze or edit data. For example, suppose you need to view a list of all Nick's Flix stores and the inventory of comedy movies at each store. Using the Master Detail Browser, you specify the table that contains the list of stores as the parent table and specify the table that contains comedy movies as the child table to quickly locate comedies and analyze the inventory.
To browse tables using the Master Detail Browser
1. Select Tools | Master Detail Browser (ALT+T+A).
2. Drag one or more tables from the Object Explorer, Object Search, or Project Manager
Toad for Data Analysts User Guide
Understand
20 window to the Diagram pane at the top of the Master Detail Browser. Press
CTRL+click to select multiple tables at once.
Notes: l
A line between tables indicates any existing relationships between the selected tables.
l
At least one parent table (table without any join arrows pointing to it) must be added to the window or an error message displays when returning results.
3. Join Columns.
4. Select the checkbox beside each column you want to include.
Note: Any columns included in a join are automatically included in the results.
5. Click (F9) to retrieve data for the parent table initially. To view data in a child table, click + to the left of each row.
or
Click to retrieve data in the parent and child tables. If there is more than one child table, a tab displays for each child table.
6. From the data grid, you can: l
Edit the data and commit your changes to the database.
l
Right-click the data grid and select Send To | option to add the data to a report, chart, or pivot grid.
Tips: l
Click to align tables and snap them to the grid.
l
Select the parent table from the drop-down list in the toolbar to view data for a parent table if there are multiple parent tables.
l
Click X on the table you want to remove in the Diagram pane to remove a table and any conditions (e.g., join, where clause) associated with the table.
Изтегляне
Реклама