home -> developer -> SQL -> tutorial -> weekly sales -> query

back next

Making a query

A query resource contains an SQL statement and specifies how to format the result table.

Weekly sales query

Navigate to your xdb folder. In a browser, go to the root folder of your WaterkenTM installation. Click "xdb". On the next page, click "www.example.com" and then "coffeebreak". This directory is your coffeebreak xdb folder. Whenever I ask you to open something in your xdb folder, I am referring to this directory. You may want to bookmark it.

Open the weekly sales query <lx2b53xaa5xnsm5mp46unp7h7m.xml>. You are looking at the map query editor; a GUI tool for creating a map query XML file. You never need to deal with the underlying XML file, you can just use this editor. Throughout the tutorial, you will see other specialty editors. Note that you must be running IE 6.0 or Mozilla 1.3 or newer for some editor features to work. You must also enable Javascript.

If you have your history list open, notice this page has an entry of "Edit: WeeklySales query." The history can help you navigate in the xdb folder by providing you with human-memorable descriptions.

Getting help

In every editor, you can click on the editor title, such as "Map Query Editor", to view a detailed help page. You may also roll your mouse over labels or input elements for a brief description of the element. Most labels also link to a schema, which gives you more information.

The comment textarea contains a description of the query. The first sentence of the comment is used as the page title, which is the history list entry.

SQL code

The SQL code field specifies the SQL statement. This statement should be in whatever version of SQL your database accepts. As is standard, use question marks ("?") to stand in for parameters. The weekly sales query does not require any parameters.

Map construction

The key and value fields tell the server how to construct the map that it returns. Since the weekly sales query returns a map of primitive types, a string to an integer, the "primitive" radio button is selected. The field adjacent to the radio button specifies which data to use for the key and which for the value. The weekly sales SQL statement fetches the coffee name from "COF_NAME" and the sales from "SALES". To use the coffee name as the map key, "COF_NAME" appears in the key primitive input. "SALES" appears in the value primitive input.

The Webizer also supports composite datatypes, datatypes composed of more than one table column value. You will see an example of using a composite datatype in the price list example.

To make the weekly sales query invokable, we must wrap it in a record. The next page discusses creating a record.

top

Copyright 2002 - 2003 Waterken Inc. All rights reserved.

Powered by Waterken Server! Valid XHTML 1.0! Valid CSS!