Introduction

Tutorials

Data types and nodes

Reference

Installing GeoData Manager

w# Making ad hoc queries of the database

You can make ad hoc queries on any tables in the database. Ad hoc queries let you:

Warning

This lets you you can change and delete parts of the database, which might delete some of your data or cause GeoData Manager to crash.

Making queries

To query an SQL server database you must have Administrator permission.

From within GeoData Manager, click Menu in the menu bar, then click Database Administration to display:

The left has a list of all tables in the currently-open database and the right is to type SQL queries.

After you have finished:

  1. Close this window.
  2. If you made any changes to the database, close GeoData Manager and restart it again, to ensure the database is refreshed.

Note

Example: Selecting all data in a table

This selects all data in the table [WELL], which is the header data of the wells. This data is displayed by GeoData Manager at the node Location and Deviation; there are 37 wells in the sample database.

The result of the query is displayed at the bottom. There are 37 records, as expected. The units are SI and the order is the order in the table, not any order you set in Location and Deviation.

You can also run this query by double-clicking the table name on the left.

Example: Selecting hot wells for a group

This selects wells that have test results greater than 250 degrees C; such test results are stored in the table WELPRES. We then create a group or filter group of these wells.

  1. Click Clear SQL, type the query below and click Run SQL:

    There are 11 wells with measurements over 250 C.

  2. Click Save to store the wells as a temporary table in the database.

  3. Now run an SQL command to add the 11 wells as a new group or filter group in the table [WELLGRP].

Note that in this case you can do the same from within GeoData Manager, because you can see all of the table WELPRES at the Reservoir or Steamfield node:

  1. Navigate to Reservoir or Steamfield.

  2. Click at the left of the filter bar, and click No Filter to see all measurements in WELPRES.

  3. Use the Detail Filter tab to select wells with measurements > 250 C: For the Detail Filter Field, select Well Temperature, click Between Limits and enter a lower limit 250 C and a high upper limit, say 2,000 C; click Apply to Detail.

  4. In the header window, look at each data set in turn and tag the ones that have any detail data showing.

  5. Click at the left of the filter bar, and click Save tagged group or Save sites to Filter Group.

Example: Exporting well locations as a Surfer map

  1. Click Clear SQL, type the query below and click Run SQL:

    This selects the 11 wells again, and returns the well location as well as the well name.

  2. Surfer requires a csv file, with Location E, Location N and well name. Click the to the right of Export and click Comma Separated Value File. Setup the export like this:

    and click OK.

Example: Moving data from one column to another

Header data for a well has several columns for comments. If you decide to use a different convention for what you write in these columns, then you might want to move comments from one column to another.

  1. Click Clear SQL, type the query below and click Run SQL:

  2. Click Clear SQL, type the query below and click Run SQL:

Example: Entering data directly

Usually use Geodata Manager's Import command to import data from a file into GeoData Manager, for example, to read a spreadsheet file of downhole measurements. This becomes cumbersome if you have many data sets to enter, and in some circumstances it is possible to import many data sets at once by using ad hoc queries, which can be fast. However, to create a data set, you must add a header data record to one table and a detail data record to another table, which can be messy. Favorable circumstances to use ad hoc queries are:

Note that creating new data sets this way does not perform the Process, Check or Apply that you would normally do after creating or editing a data set. Therefore the new data set might have inconsistent data, and no data will have been calculated (for example if you only supply Location E then Location Lon will be empty).