Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:

By submitting your information, you agree that databasejournal.com may send you databasejournal offers via email, phone and text message, as well as email offers about other products and services that databasejournal believes may be of interest to you. databasejournal will process your information in accordance with the Quinstreet Privacy Policy.

News Via RSS Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

MS Access

Posted Jan 5, 2004

MS Access for the Business Environment: Access Query Techniques: Using the TOP Keyword

By William Pearson

About the Series ...

This article continues the series, MS Access for the Business Environment. The primary focus of this series is an examination of business uses for the MS Access relational database management system. The series is designed to provide guidance in the practical application of data and database concepts to meet specific needs in the business world. The majority of the procedures I demonstrate in this article and going forward will be undertaken with MS Access 2003, although most of the concepts that we explore in the series will apply to earlier versions of MS Access, as well.

For more information on the series, as well as the hardware / software requirements to prepare for the tutorials we will undertake, please see Tutorial 1: Create a Calculated Field with the Expression Builder.

Introduction to this Tutorial

In our last lesson, Access Query Techniques: Subqueries, Part I, we introduced subqueries within the context of MS Access, and practiced their creation and use in rendering a result dataset to meet illustrative business needs. As a part of our exploration of subqueries, we examined the syntax surrounding the use of a straightforward sample subquery; we then began an illustrative, hands-on example of the use of a subquery in a multi-step practice exercise. After evolving an initial query, we created a second query, within which we nested the first, to demonstrate the operation of a subquery in our practice exercise. Finally, we briefly discussed various aspects of the results datasets that we obtained in each step of the practice examples.

Before moving to our next article, Access Query Techniques: Subqueries, Part II, we will first consider a keyword whose use we will see again in the second half of our exploration of subqueries, as well as elsewhere. We will overview the TOP keyword, and get a feel for its operation in an undistracted scenario, before proceeding into the creation of a subquery that leverages the keyword to illustrate more sophistication in the use of subqueries than we saw in Part I.

The objective of this lesson is to introduce the TOP keyword as it is used in Microsoft Jet SQL, and to explore ways we can use it to meet illustrative business needs. To accomplish this, we will follow our approach in previous lessons, and perform the following activities surrounding our examination of the TOP keyword:

  • an examination of the syntax surrounding the use of TOP;
  • an illustrative, hands-on example of the use of TOP in a practice exercise;
  • a similar example where we use the optional PERCENT keyword, in conjunction with TOP, to return a percentage, versus a number, of rows in an illustrative dataset;
  • a brief discussion of the results datasets that we obtain in each of the practice examples.

We will use the Northwind sample database that installs with MS Access for purposes of this lesson, in an attempt to make our discussion useful to virtually anyone who has access to the application.

MS Access Archives

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Latest Forum Threads
MS Access Forum
Topic By Replies Updated
Help With Microsoft Access kasy 0 September 4th, 07:35 PM
Linked table not sorting or filtering - ODBC error Java 1 August 28th, 10:37 AM
Use Parameter in select statement (Sql in Microsoft Access) katty.jonh 1 July 25th, 06:45 AM
Query Issue algebroni 7 July 23rd, 04:22 PM