Building Your Query

Before you can build a query to use on the search page, you need to decide:

To illustrate how a database query is created, the following example will use Microsoft Access as the database management tool.

Û To Create an SQL Query in Microsoft Access 97

  1. Launch Microsoft Access 97 and open the Northwind Traders sample database file (northwind.mdb).

  2. In the Northwind : Database dialog box, click the Queries tab.

    Northwind Traders contains a set of pre-defined queries.

  3. Double-click the Sales by Category query to display a the query results.

    The field names used in this query are Category ID, Category Name, Product Name, and Product Sales.

    Category ID is an internal code for the employees of Northwind Traders that will have no meaning to users searching for sales data in a Web browser. You will therefore remove it from the final query.

  4. On the Microsoft Access View menu, choose Design View to modify the query.

  5. In the lower half of the Design View, deselect the check box below the CategoryID entry in the table.

  6. On the View menu, choose Datasheet View.

    The query is resubmitted and the new results now only show the fields you want to include. The Category ID field has been successfully omitted.

  7. On the View menu, choose SQL View.

    This option switches the current query view to the actual SQL language query that Microsoft Access generated to create the search results.

Leave the SQL View window displayed. You will return to Microsoft Access in the next section, where you will copy and paste this code into the FrontPage Database Region Wizard.