Senior Fitness - Exercise and Nutrition for Aging Men and Women
FREE Article Feed for your website.
Home Ownership Magazine
Party Planning Information
Article Marketing Resources
Bio-Medical Research Article Database
Informative Articles on Life, Love and Happiness
Tutorials on Business to Writing
Famous Quotes from Famous People
Song Lyric Information
New US Patent Information
Comprehensive List of Content by Category
Online Auctions and Shopping Related Articles
Article Search
Most Recent Articles
Title: Modulation circuit with integrated microelectro-mechanical system (MEMS) components
Patent Number: 7,417,511 Issued on 08/26/2008 to Menke

Title: Direct digital interpolative synthesis
Patent Number: 7,417,510 Issued on 08/26/2008 to Huang

Title: Spread spectrum modulation of a clock signal for reduction of electromagnetic interference
Patent Number: 7,417,509 Issued on 08/26/2008 to Kultgen

Title: Multiple RF path amplifiers
Patent Number: 7,417,508 Issued on 08/26/2008 to Quaglietta

Title: Bias circuit for power amplifier having a low degradation in distortion characteristics
Patent Number: 7,417,507 Issued on 08/26/2008 to Yamamoto,   et al.

Title: Amplifier having switchable negative feedback
Patent Number: 7,417,506 Issued on 08/26/2008 to Klein,   et al.

Title: CMOS amplifiers with frequency compensating capacitors
Patent Number: 7,417,505 Issued on 08/26/2008 to Forbes,   et al.

Title: Startup and shutdown click noise elimination for class D amplifier
Patent Number: 7,417,504 Issued on 08/26/2008 to Strydom,   et al.

Title: Method for high efficiency audio amplifier
Patent Number: 7,417,503 Issued on 08/26/2008 to Xu,   et al.

Title: Selectable power supply for audio amplifier
Patent Number: 7,417,502 Issued on 08/26/2008 to Cochrane

Title: Variable inductor, oscillator including the variable inductor and radio terminal comprising this oscillator, and amplifier including the variable inductor and radio terminal comprising this am
Patent Number: 7,417,501 Issued on 08/26/2008 to Fujimoto,   et al.

Title: Control of an adjustable gain amplifier
Patent Number: 7,417,500 Issued on 08/26/2008 to Arnott

Title: Gain controlled amplifier and cascoded gain controlled amplifier based on the same
Patent Number: 7,417,499 Issued on 08/26/2008 to Moon,   et al.

Title: Amplifier with feedback bridge
Patent Number: 7,417,498 Issued on 08/26/2008 to Wiegner,   et al.

Title: PWM modulator and class-D amplifier having the same
Patent Number: 7,417,497 Issued on 08/26/2008 to Lee

Title: Demodulator circuit of RFID system
Patent Number: 7,417,496 Issued on 08/26/2008 to Kang,   et al.

Title: Reconfigurable frequency filter
Patent Number: 7,417,495 Issued on 08/26/2008 to Li

Title: Voltage generator in a flash memory device
Patent Number: 7,417,493 Issued on 08/26/2008 to Lee

Title: Constant current output charge pump
Patent Number: 7,417,491 Issued on 08/26/2008 to Wu,   et al.

Title: Internal voltage generator of semiconductor integrated circuit
Patent Number: 7,417,490 Issued on 08/26/2008 to Kim

Title: Regulation circuit for inductive charge pump
Patent Number: 7,417,488 Issued on 08/26/2008 to Ahmed,   et al.

Title: Overheat detecting circuit
Patent Number: 7,417,487 Issued on 08/26/2008 to Mori

Title: Voltage-current conversion circuit, amplifier, mixer circuit, and mobile appliance using the circuit
Patent Number: 7,417,486 Issued on 08/26/2008 to Koutani,   et al.

Title: Differential energy difference integrator
Patent Number: 7,417,485 Issued on 08/26/2008 to Vecera

Title: Level shifter with boost and attenuation programming
Patent Number: 7,417,484 Issued on 08/26/2008 to Voo

Title: Wide-band wide-swing CMOS gain enhancement technique and method therefor
Patent Number: 7,417,483 Issued on 08/26/2008 to Wong,   et al.

Title: Adaptive voltage scaling for an electronics device
Patent Number: 7,417,482 Issued on 08/26/2008 to Elgebaly,   et al.

Title: Controlling signal states and leakage current during a sleep mode
Patent Number: 7,417,481 Issued on 08/26/2008 to Ahsanullah,   et al.

Title: Duty cycle correction circuit whose operation is largely independent of operating voltage and process
Patent Number: 7,417,480 Issued on 08/26/2008 to Boerstler,   et al.

Title: Duty detection circuit and method for controlling the same
Patent Number: 7,417,479 Issued on 08/26/2008 to Kitayama

Title: Delay line circuit
Patent Number: 7,417,478 Issued on 08/26/2008 to Kim,   et al.

Title: Power-on-reset circuit with output reset to ground voltage during power off
Patent Number: 7,417,476 Issued on 08/26/2008 to Hung

Title: Circuit and method for generating power up signal
Patent Number: 7,417,475 Issued on 08/26/2008 to Byeon,   et al.

Title: Clock frequency division methods and circuits
Patent Number: 7,417,474 Issued on 08/26/2008 to Jamal

Title: Multi-channel integrated circuit
Patent Number: 7,417,472 Issued on 08/26/2008 to Tumer,   et al.

Title: Voltage comparator having hysteresis characteristics
Patent Number: 7,417,471 Issued on 08/26/2008 to Gong,   et al.

Title: Phase frequency detector with a novel D flip flop
Patent Number: 7,417,470 Issued on 08/26/2008 to Riley

Title: Compensation for leakage current from dynamic storage node variation by the utilization of an automatic self-adaptive keeper
Patent Number: 7,417,469 Issued on 08/26/2008 to Cheng,   et al.

Title: Dynamic and differential CMOS logic with signal-independent power consumption to withstand differential power analysis
Patent Number: 7,417,468 Issued on 08/26/2008 to Verbauwhede,   et al.

Title: Flip-flop circuit and frequency divider using the flip-flop circuit
Patent Number: 7,417,466 Issued on 08/26/2008 to Akahori

Title: N-domino output latch
Patent Number: 7,417,465 Issued on 08/26/2008 to Lundberg,   et al.

Title: Bi-directional signal transmission system
Patent Number: 7,417,464 Issued on 08/26/2008 to Crawford

Title: Wireline transmission circuit
Patent Number: 7,417,463 Issued on 08/26/2008 to Danesh,   et al.

Title: Variable external interface circuitry on programmable logic device integrated circuits
Patent Number: 7,417,462 Issued on 08/26/2008 to Wong,   et al.

Title: Multi-standard transmitter
Patent Number: 7,417,460 Issued on 08/26/2008 to De Laurentiis,   et al.

Title: On-die offset reference circuit block
Patent Number: 7,417,459 Issued on 08/26/2008 to Wilson,   et al.

Title: Gate driving circuit and display apparatus having the same
Patent Number: 7,417,458 Issued on 08/26/2008 to Ahn,   et al.

Title: Scalable non-blocking switching network for programmable logic
Patent Number: 7,417,457 Issued on 08/26/2008 to Pani,   et al.

Title: Dedicated logic cells employing sequential logic and control logic functions
Patent Number: 7,417,456 Issued on 08/26/2008 to Verma,   et al.

Title: Programmable function generator and method operating as combinational, sequential and routing cells
Patent Number: 7,417,455 Issued on 08/26/2008 to Verma,   et al.

Title: Low-swing interconnections for field programmable gate arrays
Patent Number: 7,417,454 Issued on 08/26/2008 to Rahman,   et al.

Title: System and method for dynamically executing a function in a programmable logic array
Patent Number: 7,417,453 Issued on 08/26/2008 to Goodnow,   et al.

Title: Techniques for providing adjustable on-chip termination impedance
Patent Number: 7,417,452 Issued on 08/26/2008 to Wang,   et al.

Title: Leakage power management with NDR isolation devices
Patent Number: 7,417,451 Issued on 08/26/2008 to Kawa

Title: Testing combinational logic die with bidirectional TDI-TMS/TDO chanel circuit
Patent Number: 7,417,450 Issued on 08/26/2008 to Whetsel

Title: Wafer stage storage structure speed testing
Patent Number: 7,417,449 Issued on 08/26/2008 to Posey,   et al.

Title: System to calibrate on-die temperature sensor
Patent Number: 7,417,448 Issued on 08/26/2008 to Lim,   et al.

Title: Probe cards employing probes having retaining portions for potting in a retention arrangement
Patent Number: 7,417,447 Issued on 08/26/2008 to Kister

Title: Probe for combined signals
Patent Number: 7,417,446 Issued on 08/26/2008 to Hayden,   et al.

Title: Probing method and prober for measuring electrical characteristics of circuit devices
Patent Number: 7,417,445 Issued on 08/26/2008 to Sakagawa,   et al.

Title: Method and apparatus for inspecting integrated circuit pattern
Patent Number: 7,417,444 Issued on 08/26/2008 to Shinada,   et al.

Title: Determination of effective resistance between a power sourcing equipment and a powered device
Patent Number: 7,417,443 Issued on 08/26/2008 to Admon,   et al.

Title: Method and apparatus for testing tunnel magnetoresistive effect element, manufacturing method of tunnel magnetoresistive effect element and tunnel magnetoresistive effect element
Patent Number: 7,417,442 Issued on 08/26/2008 to Hachisuka,   et al.

Title: Methods and systems for guarding a charge transfer capacitance sensor for proximity detection
Patent Number: 7,417,441 Issued on 08/26/2008 to Reynolds

Title: Methods and systems for the rapid detection of concealed objects
Patent Number: 7,417,440 Issued on 08/26/2008 to Peschmann,   et al.

Title: Impedance conversion circuit and integrated circuit including thereof
Patent Number: 7,417,439 Issued on 08/26/2008 to Hirabayashi,   et al.

Title: Battery voltage measurement apparatus
Patent Number: 7,417,438 Issued on 08/26/2008 to Miyamoto

Title: Vehicle battery testing assembly
Patent Number: 7,417,437 Issued on 08/26/2008 to Torres

Title: Selectable tap induction coil
Patent Number: 7,417,436 Issued on 08/26/2008 to Chesser,   et al.

Title: Method for generating a homogeneous magnetization in a spatial examination volume of a magnetic resonance installation
Patent Number: 7,417,435 Issued on 08/26/2008 to Diehl

Title: Magnetic resonance imaging system with iron-assisted magnetic field gradient system
Patent Number: 7,417,434 Issued on 08/26/2008 to Overweg

Title: Method, examination apparatus and antenna array for magnetic resonance data acquisition
Patent Number: 7,417,433 Issued on 08/26/2008 to Heid,   et al.

Title: Asymmetric ultra-short gradient coil for magnetic resonance imaging system
Patent Number: 7,417,432 Issued on 08/26/2008 to Overweg

Title: Coil array for magnetic resonance imaging with reduced coupling between adjacent coils
Patent Number: 7,417,431 Issued on 08/26/2008 to Lanz,   et al.

Title: Continuous moving-table MRI contrast manipulation and/or update of scanning parameters
Patent Number: 7,417,430 Issued on 08/26/2008 to Aldefeld,   et al.

System, method and computer readable medium for performing an aggregate database query Number:7,062,494 from the United States Patent and Trademark Office (PTO) owispatent

Home    Author Login    Submit Article    Article Search    Add Your Link    Edit Your Link    Contact Us    Advertising    Disclaimer

   

 
Web LinkGrinder.com

Top Breaking News
     Greek, Cypriot Leaders Resume Unification Talks in Nicosia by Nathan Morley
     Indonesia Tobacco Sales Grow, Raising Health Fears
     South Korea Allows Top Defector to Travel Overseas by VOA News

Title: System, method and computer readable medium for performing an aggregate database query

Abstract: A method for performing a query on records in a table is disclosed. The table has at least a first field, a second field and a third field. The query is for obtaining an aggregate result on the third field of records for at least one combination of the first and the second fields. The method includes receiving a query involving a single query statement. This query statement includes at least one built-in function corresponding to the second field of the combination. Each built-in function includes a mathematical formula that selects only a third field of records whose second field equals the second field of the combination. The method also includes executing the query statement to produce the aggregate result.

Patent Number: 7,062,494 Issued on 06/13/2006 to Kulkarni


Inventors: Kulkarni; Suhas Sudhakar (Thane, IN)
Assignee: Hewlett-Packard Development Company, L.P. (Houston, TX)
Appl. No.: 201436
Filed: July 22, 2002


Current U.S. Class: 707/100 ; 707/200; 707/4
Current International Class: G06F 17/30 (20060101)
Field of Search: 707/1-10,100-102,104.1,200-201 715/533 718/104


References Cited [Referenced By]

U.S. Patent Documents
6115705 September 2000 Larson
6148298 November 2000 LaStrange et al.
6182061 January 2001 Matsuzawa et al.
6778976 August 2004 Haas et al.
6842753 January 2005 Chaudhuri et al.
2002/0010695 January 2002 Kearsey et al.
2003/0004959 January 2003 Kotsis et al.
Primary Examiner: Robinson; Greta
Assistant Examiner: Le; Miranda

Claims



I claim:

1. A computer-implemented method for performing a query on records in a table with at least a first field, a second field and a third field to obtain an aggregate result on the third field of records for at least one selected combination of the first and the second fields, the method comprising; receiving a query involving a single query statement that includes at least one built-in function corresponding to the second field of the selected combination, wherein the built-in function includes a mathematical formula that selects only a third field of records whose second field is equal to the second field of the selected combination, wherein the mathematical formula is: round(((X-mod(Y,X))/X)-0.5)*Z where X is the second field of the selected combination; Y is an occurrence of the second field of a record; and Z is an occurrence of the third field of a record; wherein the second field is obtained from a range having a maximum value that is not more twice a minimum value; executing the query statement to produce the aggregate result; and displaying the aggregate result in a horizontal format which includes a row corresponding to each first field wherein the row includes an aggregate result for each second field.

2. A method according to claim 1, wherein executing the query statement includes executing the query statement to produce the aggregate result without generation of an intermediate view.

3. A method according to claim 1, wherein the aggregate query includes one of a sum and a maximum operation.

4. A method according to claim 1, wherein the at least one selected combination of the first and the second fields includes all unique combinations of the first and the second fields and wherein receiving a query includes receiving a query involving a single query statement that includes a plurality of built-in functions corresponding to each second field of the combinations, wherein each built-in function includes a mathematical formula that selects only a third field of records whose second field is equal to the second field described in the built-in function.

5. A program storage device readable by a computing device, tangibly embodying a program of instructions, executable by the computing device to perform a method for performing a query on records in a table with at least a first field, a second field and a third field, to obtain an aggregate result on the third field of records for at least one selected combination of the first and the second fields, the method comprising: receiving a query involving a single query statement that includes at least one built-in function corresponding to the second field of the selected combination, wherein the built-in function includes a mathematical formula that selects only a third field of records whose second field is equal to the second field of the selected combinations, wherein the mathematical formula is: round(((X-mod(Y,X))/X)-0.5)*Z where X is the second field of the selected combination; Y is an occurrence of the second field of a record; and Z is an occurrence of the third field of a record; wherein the second field is obtained from a range having a maximum value that is not more twice a minimum value; executing the query statement to produce the aggregate result; and displaying the aggregate result in a horizontal form at which includes a row corresponding to each first field wherein the row includes an aggregate result for each second field.

6. A computer-implemented method for performing a query on records in a table with at least a first field type and a second field type to obtain an aggregate result on second field occurrences of records for at least one selected first field occurrence, the method comprising; receiving a query involving a single query statement that includes at least one built-in function corresponding to the selected first field occurrence, wherein the built-in function includes a mathematical formula that selects only a second field occurrence of records whose first field occurrence is equal to the selected first field, wherein the mathematical formula is: round(((X-mod(Y,X))/X)-0.5)*Z where X is the second field of the selected combination; Y is an occurrence of the second field of a record; and Z is an occurrence of the third field of a record; wherein the second field is obtained from a range having a maximum value that is not more twice a minimum value; executing the query statement to produce the aggregate result; and displaying the aggregate result in a horizontal format which includes a row wherein the row includes an aggregate result for each first field.
Description



BACKGROUND

This invention relates generally to database systems, and more particularly to an aggregate query in database systems.

A database is a collection of information. Relational databases are typically illustrated as one or more two-dimensional tables. Each table arranges the information in rows and columns. Each row corresponds to a record. Each column corresponds to a field. In a relational database a collection of tables can be related or joined to each other through a common field or key. The common key enables information in one table to be automatically cross-referenced to corresponding information in another table.

A complex search may be performed on a database with a query. A query specifies a set of criteria (e.g., the quantity of parts from a particular transaction) to define identified information for a database program to retrieve from the database. An aggregate query is a query that requests information concerning a selected group of records. For example, in a database which stores sales transactions, an aggregate query may request the total quantity of an item in a particular transaction. Each aggregate query may include a set of criteria to select records (e.g., grouping of records by an item code field and a transaction code field), and an operation to perform on the group of selected records (e.g., summing the quantity fields). Typical operations for aggregate queries include counting, summing, averaging, and finding minimum and maximum values.

To perform an aggregate query, a conventional database management system (DBMS) examines every record in the database to determine whether or not the record matches the set of criteria. The DBMS constructs a query table, known as a virtual table or view, from the records that match the set of criteria. The DBMS then performs the required aggregate operation over the appropriate fields from each record in the view.

As an illustration, the table below, TRANSACTION_TABLE, is one which can be queried using an aggregate query. The table has three fields arranged in a vertical format. The three fields are an ITEM_CODE field, a TRANSACTION_CODE field and a QUANTITY field. Separate records may have the same ITEM_CODE field and TRANSACTION_CODE field. An aggregate query may involve summing the QUANTITY fields of records sharing the same ITEM_CODE field and TRANSACTION_CODE field.

TABLE-US-00001 TABLE 1 TRANSACTION_TABLE ITEM_CODE TRANSACTION_CODE QUANTITY Item_1 20 200 Item_1 20 50 Item_1 21 70 Item_1 22 400 Item_1 22 50 Item_1 22 25 Item_1 24 50 Item_1 25 80 Item_1 30 65 Item_2 20 100 Item_2 21 85 Item_2 23 35 Item_2 23 80 Item_2 26 250 Item_2 27 320 Item_2 28 90

The output of the aggregate query may be tabulated in an OUTPUT_TABLE as follows:

TABLE-US-00002 TABLE 2 OUTPUT_TABLE Sum Sum Sum Sum Sum Sum Sum Sum Sum Sum Sum ITEM_CODE 20 21 22 23 24 25 26 27 28 29 30 Item_1 250 70 475 0 50 80 0 0 0 0 65 Item_2 100 85 0 115 0 0 250 320 90 0 0

Such an aggregate query involves two steps and uses structured query language (SQL) statements as follows:

TABLE-US-00003 STEP 1: Create Intermediate Table or View create view trans_view (item_code, quantity20, quantity21, quantity22, quantity23, quantity24, quantity25, quantity26, quantity27, quantity28, quantity29, quantity 30) as select item_code, sum(quantity) as quantity20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, from transaction_table where transaction_code=20 group by item_code union select item_code, 0 sum(quantity) as quantity21, 0, 0, 0, 0, 0, 0, 0, 0, 0, from transaction_table where transaction_code=21 group by item_code union select item_code, 0, 0, sum(quantity) as quantity22, 0, 0, 0, 0, 0, 0, 0, 0, from transaction_table where transaction_code=22 group by item_code union . . . select item_code, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sum(quantity) as quantity30, from transaction_table where transaction_code=30 group by item_code; Step 2: Query the Intermediate View select item_code, sum(quantity20) as sum20, sum(quantity21) as sum21, sum(quantity22) as sum22, sum(quantity23) as sum23, sum(quantity24) as sum24, sum(quantity25) as sum25, sum(quantity26) as sum26, sum(quantity27) as sum27, sum(quantity28) as sum28, sum(quantity29) as sum29, sum(quantity30) as sum30 from trans_view group by item_code;

As can be seen from the above statements, the first step involves generation of an intermediate table or view (trans_view) from information stored in the TRANSACTION_TABLE. The second step queries the intermediate view (trans_view) to produce the OUTPUT_TABLE. The query statements are lengthy and may be difficult to maintain.

SUMMARY

According to an aspect of the present invention, there is provided a method for performing a query on records in a table. The table has at least a first field, a second field and a third field. The query is for obtaining an aggregate result on the third field of records for at least one combination of the first and the second fields. The method includes receiving a query involving a single query statement. This query statement includes at least one built-in function corresponding to the second field of the combination. Each built-in function includes a mathematical formula that selects only a third field of records whose second field equals the second field of the combination. The method also includes executing the query statement to produce the aggregate result.

According to another aspect of the present invention, there is provided a program storage device readable by a computing device, tangibly embodying a program of instructions, executable by the computing device to perform the above-described method.

According to yet another aspect of the present invention, there is provided a method for performing a query on records in a table. The table has at least a first field type and a second field type. The query is for obtaining an aggregate result on second field occurrences of records for at least a selected first field occurrence. The method includes receiving a query involving a single query statement. This single query statement includes at least one built-in function corresponding to the selected first field occurrence. The built-in function includes a mathematical formula that selects only a second field occurrence of records whose first field occurrence is equal to the selected first field. The query also includes executing the query statement to produce the aggregate result.

BRIEF DESCRIPTION OF DRAWINGS

The invention will be better understood with reference to the drawings, in which;

FIG. 1 is a flowchart showing a sequence of steps for performing an aggregate query according to an embodiment of the present invention;

FIG. 2 is a single SQL query statement that supports the sequence in FIG. 1; and

FIG. 3 is a block diagram of a computing device on which the sequence in FIG. 1 may be implemented.

DETAILED DESCRIPTION

In any database table, such as the TRANSACTION_TABLE in the background section, a field is the smallest named unit of data. A table will, in general, contain many occurrences or instances of each of several types of fields. For example, the TRANSACTION_TABLE includes three types of fields, an ITEM_CODE field type, a TRANSACTION_CODE field type and a QUANTITY field type and many occurrences of each of these field types. An entry in the TRANSACTION_TABLE relating one of each of the field types is known as a record. Similarly, a record type is distinguishable from a record occurrence or instance. A record occurrence or instance includes a group of related field occurrences. Therefore, a record occurrence in the TRANSACTION_TABLE includes an occurrence of the ITEM_CODE field type, the TRANSACTION_CODE field type and the QUANTITY field type. It is common practice to drop the qualifiers "type" and "occurrence" for fields and records, and to rely on context to indicate which of the two is meant. Such a practice is convenient, and is adopted in the following description of the invention.

The TRANSACTION_TABLE contains multiple records, some of which share a same ITEM_CODE field and a TRANSACTION_CODE field. The records in the TRANSACTION_TABLE are said to be arranged in a vertical format. Although the TRANSACTION_TABLE includes only three fields, it should be noted that the invention could be practiced on database tables with two fields and four or more fields. For a table, such as the TRANSACTION_TABLE, it is sometimes desirable to obtain an aggregate result, such as the sum, of the QUANTITY fields of records having a particular combination of the ITEM_CODE and the TRANSACTION_CODE fields. For example, there are two records in the TRANSACTION_TABLE having an ITEM_CODE field of "Item.sub.--1" and a TRANSACTION_CODE field of "20". Addition of the QUANTITY fields of these two records yields a result of "250." It would be desirable for a user to be able to query the TRANSACTION_TABLE to obtain such a total of the QUANTITY fields of these two records.

Similarly, it is desirable to query the TRANSACTION_TABLE to obtain the sum of the QUANTITY fields for other records having unique combinations of the ITEM_CODE field and the TRANSACTION_CODE field. The OUTPUT_TABLE in the background section is a tabulation of aggregate results obtained from such a query. The fields, SUM20, SUM21, SUM23 . . . , SUM29, SUM30 in the OUTPUT_TABLE are aggregate results for records having TRANSACTION_CODE fields of 20, 21, 22 . . . , 29, 30 respectively for each ITEM_CODE field. The SUM fields in the OUTPUT_TABLE are arranged in a horizontal format.

On a computing device that supports a database management system (DBMS), a user issues a query to obtain the aggregate results in the OUTPUT_TABLE. FIG. 1 shows a Structured Query Language (SQL) statement 2 that effects such a query. The query statement 2 includes several built-in functions 4 corresponding to each predetermined occurrence of the TRANSACTION_CODE field. In the TRANSACTION_TABLE, these predetermined occurrences are integers 20 30. Each built-in function includes a mathematical formula 6 that selects only a QUANTITY field of records whose TRANSACTION_CODE field is equal to the TRANSACTION_CODE field of the built-in function. The QUANTITY fields related to other TRANSACTION_CODE fields are ignored. The mathematical formula 6 will be described in more details shortly.

FIG. 2 is a flowchart showing a sequence 10 of steps for performing an aggregate query on a database table, such as the TRANSACTION_TABLE, according to an embodiment of the present invention. The sequence 10 starts in an ALLOCATE TRANSACTION_CODE step 12, wherein a range of integers having a maximum value that is not more than twice a minimum value is allocated to be used as the TRANSACTION_CODE fields. An example of such a range are the integers between 20 30. The sequence 10 next proceeds to a POPULATE TABLE step 14, wherein records are entered in the TRANSACTION_TABLE.

After the TRANSACTION_TABLE is populated with records, the sequence 10 proceeds to an ISSUE QUERY step 16, wherein the SQL query statement 2 is issued to the DBMS. The sequence 10 ends in a RETURN RESULT step 18, wherein the DBMS receives the query, executes it and returns the result in a horizontal format according to the OUTPUT_TABLE. The result is grouped according to the ITEM_CODE field. There is a row corresponding to each ITEM_CODE field. The row includes an aggregate result of the QUANTITY fields for each TRANSACTION_CODE field.

The mathematical formula 6 in one of the built-in functions 4, in this case a built-in function 4 corresponding to a TRANSACTION_CODE field of "20" is next described. This mathematical formula is as follows: round(((20-mod(TRANSACTION_CODE,20))/20)-0.5)*QUANTITY

A first portion 30 (FIG. 1) of the mathematical formula 6 works out to be unity only if the TRANSACTION_CODE field of a record is "20". In that case, the QUANTITY field of the record is "selected" to be processed as part of the aggregate query. For records with a TRANSACTION_CODE field that is not equal to "20", the first portion 30 works out to be zero so that the respective QUANTITY fields are ignored in the aggregate query. The mathematical formula, expressed in a more general format, is as follows: round(((X-mod(Y,X))/X)-0.5)*Z where X is a selected occurrence of a selected field of a record; Y is an occurrence of the selected field; and Z is an occurrence of another field in the record.

Modifications to the query statement 2 in FIG. 1 are possible. As an example, a line "where ITEM_CODE=Item.sub.--1" may precede the line "group by item_code" in the query statement if it is desired to obtain only an aggregate result of records whose ITEM_CODE field equals "Item.sub.--1". As another example, the built-in functions 4 may also be selected according to the desired TRANSACTION_CODE fields instead of including built-in functions 4 for all TRANSACTION_CODE fields. Therefore the query statement 2 may include at least one built-in function 4 corresponding to a selected TRANSACTION_CODE field.

FIG. 3 is a block diagram illustrating typical elements of a computing device 40 on which the DBMS may be supported. The elements include a programmable processor 42 connected to a system memory 44 via a system bus 46. The processor 42 accesses the system memory 44 as well as other input/output (I/O) channels 48 and peripheral devices 50. The computing system 40 further includes at least one program storage device 52, such as a CD-ROM, tape, magnetic media, EPROM, EEPROM, ROM or the like. The computing system 40 stores one or more computer programs that implement the sequence 10 described above. The processor 42 reads and executes the one or more computer programs to perform the sequence 10.

Advantageously, the method of performing an aggregate query described above results in a more compact query statement than the prior art. This compact query statement is easier to understand and maintain. Moreover, there is no need for the creation of any temporary table or view.

Although the present invention is described as implemented in the above embodiment, it is not to be construed to be limited as such. For example, instead of limiting the aggregate operation to a sum operation, the aggregate operation may also be a maximum operation.

As another example, the query statement is described above as an interactive query language. The query statement may also be used as a database programming language embedded within a variety of host languages.

*


Free Web Sudoku Puzzles.
Solve with your browser.
        3   1    
6   7       9    
2 8       9   3  
      1     4 5  
      2   8      
  9 5     3      
  5   8       4 7
    2       3   5
    8   2        
What is it?



Add Your Site · Terms Of Service · Privacy Policy


DISCLAIMER
Linkgrinder is a free service that searches the Internet and indexes all files found so that you may search quickly and easily for shared files. These files are created and made available individually by users whose identity we are not aware of and who we have no control over. In essence we function like a search engine tool; these files ARE NOT STORED OR SERVED BY OUR NETWORK. We are not responsible for any materials obtained by using our service. We do not monitor any of the contents of these files. These files may contain viruses, illegal materials, materials inappropriate for minors, offensive files and the like. BY USING OUR SERVICE, YOU ASSUME FULL RESPONSIBILITY FOR DOWNLOADING THESE MATERIALS AND WILL INDEMNIFY US FOR ANY DAMAGES THAT MAY BE INCURRED.

For More Specific Information VIEW OUR TERMS OF SERVICE.

Thank you and Enjoy!