Aggregate Product function extends SQLhttp://productfunctionsql.codeplex.com/project/feeds/rssSuggested universal solutions extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function, portable to any SQL-backed databases.Updated Wiki: Homehttps://productfunctionsql.codeplex.com/wikipage?version=5<div class="wikidoc"><b>Project Description</b><br />Suggested universal solutions extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function, portable to any SQL-backed databases.<br /><br />Entire “pure SQL” solution is encapsulated into a single query, portable to any SQL backed databases, for example, Microsoft Access or SQL server. Several solutions, which differ in terms of their performance-universality metrics, are presented and discussed. (Note: <b>refer to the working DEMO: Access Database file, attached to this project, containing sample data and queries, corresponding to the Listing 1...Listing 6)</b><br />
<h3>1. Key concept and definitions</h3>
<img src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=ProductFunctionSQL&DownloadId=148177" alt="SQL_Product_Function.jpg" title="SQL_Product_Function.jpg" /><br />In modern data-driven applications central database typically hosts a great deal of business logic, written in SQL. Pure SQL solutions have many practical advantages: they are native to any Database and as such, they are highly optimized and extremely effective in dealing with regular data sets; they are portable between all major commercially-available databases and are totally independent of the OS/platform. At least but not last: SQL was in place for many decades, and as such, its security vulnerability issues were pretty much identified and properly addressed. <br /><br />Alternative data-centric solutions, which involve in addition to SQL some other programming language (like C/C++, C#, VB, Java, etc.) could potentially raise the portability, performance, maintainability and application security issues; many of them are platform dependent, some of them are less efficient (especially those which do not produce the native compiled code) and each of them will inevitably add more security concerns and limitations because of their known/unknown security vulnerabilities. It’s also relevant to mention that the application maintenance and upgrade are less difficult when it’s core solution is mostly based on a single highly standardized and portable language such as SQL instead of being programmed with extended set of different (and in many cases – platform dependent) programming languages. Having all these considerations, SQL is in the core of any data-centric application.<br /><br />Standard SQL contains several aggregate functions (Sum, Count, Min, Max, etc) with pretty noticeable absent of aggregate Product. Just as a reminder, a Product function ∏ of multiple arguments (X1, X2 ,…, XN) is defined as:<br /><br />N<br />∏ (Xi) = X1 * X2 <b>….</b> XN …………………………..…………………............………………….......…………..(1)<br />i=1<br /><br />Database engine cannot perform the aggregate product calculation directly, but it can calculate sums. Simple mathematical transforms provide a workaround enabling to compute the product ∏ by using the standard built-in mathematical Log(), Exp() and SQL aggregated Sum() functions; the core technique is illustrated by mathematical formulas (2) and (3):<br /><br /><br />Log(X1 * X2 <b>….</b> XN) = Log(X1 ) <u> Log(X2) </u>… + Log(XN) …….………........….………….……(2)<br /><br />N N<br />∏(Xi )= Exp ( ∑ (Log(Xi))) ………………………….………………..................................…….…………….…(3)<br />i=1 i=1<br /><br />The last formula (3) could be programmatically translated into the equivalent SQL statement in a rather straightforward manner, enabling the calculation of aggregate Product by means of standard built-in SQL features.<br /><br />There is a certain practical limitation of using formulas (2) and (3): they provide an accurate solution applicable to any set of positive non-zero values (Xi), but this solution can not be applied directly to the negative values and zero (mathematical 0). The issue is rooted in the properties of a Log(Xi) function, which does not provide a real solution for negative numbers, plus, theoretically it should return a negative infinite value for zero input. While negative infinite is a quite common mathematical abstraction, it presents a programming challenge when translating into machine code. In order to extend formula (3) to cover the full range of positive, negative and zero-equal values, couple additional mathematical transforms must apply, namely:<br /><br />a). All negatives must be converted to positive numbers: standard Abs(Xi) function can do the job;<br /><br />b). The sign of the final expression (aggregate Product) must be defined. It could be done, for example, by counting of all negatives, then the “+” sign shall be assigned to the final expression for the even and “-“ for the odd count of negatives.<br /><br />c). The solution should implement a special handling of zeros. Quite ironically, though this case has rather simple logical solution (no computation actually needed: resulting Product must be 0 regardless of other row values) it causes some programmatic overhead, added to the SQL statement. There are couple solutions to this issue, which are discussed in greater details later in the article: one, though rather simple will cause additional methodical error rooted in the difference between “true negative infinite” in a pure mathematical sense and its approximate machine representation. Second solution will provide more accurate result by using the aggregate Min() function to detect zeros and, in case there any – to assign a zero value to the Product function output.<br />
<h3>2. Programming Technique: Math-to-SQL translation</h3>
Simplified Aggregate Product of all positive numbers: This simple yet practical example will demonstrate the SQL programming technique enabling to calculate the Product of all positive numbers {2, 4, 5, 7, 8} stored in a Microsoft Access Table1. Based on the precondition that there are no any negative values, simple SQL query can do the job of calculating Product (see its corresponding SQL statement shown in the Listing 1): Just run this query to get the accurate result of 2240 (∏ = 2<b>4</b>5<b>7</b>8 = 2240).<br />
<h5>LISTING 1</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(<span style="color:Magenta;">Log</span>([Num]))) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />The statement shown in Listing 1 is a direct SQL equivalent of the formula (3); it does not include any exception handling caused by negatives or zeros, so any of such values entered in Table1 will cause the SQL procedure to fail with error message “Invalid procedure call” (the explanation for this issue was already given in a previous discussion dedicated to the property of Log() function). The statement could be modified with IIf() conditional operator added in order to handle zeros (see Listing 2): <br />
<h5>LISTING 2</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(<span style="color:Magenta;">Log</span>(IIf([Num]=0,10^-306,[Num])))) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />The logic behind this statement is as follows: any time zero value is found the system instead of trying to calculate the Log(0) will replace zero value with extremely small positive number, for e.g. 10^(-306), close to machine 0. This simple approach has certain deficiency due to methodical error; the aggregate Product output is not exactly 0, moreover the actual result depends on other values in the rows. In many practical cases this error is relatively small and could fit the acceptable error budget. Fore more accurate calculation there is another solution with improved zero-value handling achieved through the use of conditional IIf() operator (see the corresponding SQL statement shown in the Listing 3):<br />
<h5>LISTING 3</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf([Num]=0,0,<span style="color:Magenta;">Log</span>([Num]))))*IIf(<span style="color:Magenta;">Min</span>([Num])=0,0,1) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />Additional multiplier IIf(Min(<a href="https://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>)=0,0,1) is added to the SQL statement in order to accurately “nullify” (set to 0) the return value of aggregate Product function in case at least one zero value was detected in any row. The first conditional operator is also modified, excluding 0 values from further processing (otherwise they will be converted to a small number and then passed to a Log() function). This measure allows to increase the overall computational efficiency; performance boost could be quite noticeable in case there are multiple rows in the Table1 containing zeros.<br /><br />Up to this point all discussed SQL solutions were able to calculate aggregate Product for positive numbers and zero. In the next section the universal solution will be introduced, extending the applicable range to cover negatives as well.<br />
<h4>3 Real-life example: investment performance calculation</h4>
The problem and resolution. This simple real-life example related to the investment performance calculation will serve both practical and didactical purposes, demonstrating the application of the SQL aggregate Product programming technique. Based on the commonly accepted practice, the compound annual performance (ANNUAL_PFM) of the financial investment portfolio could be calculated on the basis of its monthly performance array PFMi (i=1…12) as following:<br /><br />ANNUAL_PFM = (1+PFM1) *(1+ PFM2) *…*(1+PFM12) -1 .................................. (4)<br /><br />Similar approach is applicable to the Quarterly Performance (Q_PFM), Semi-Annual, 3-, 5- and 10 years performance calculation, etc. Programmatically, all this type of compound investment performance calculations could use the same Aggregate Product function and differ only by CROUP BY clause. Following two examples will demonstrate this technique in regards to Annual and Quarterly performance calculation. Sample Table2 in the supplement database contains some hypothetical XYZ portfolio monthly performance data entered for two consequent years, 2004 and 2005 (please notice, that all data in this article and corresponding downloads is shown for demonstration purpose only and does not represent any actual financial information).<br /><br />Investment performance is typically presented in a percent; here the numbers shown are stored as a relative values, provided that the conversion to percent could be done later on a different layers (mid-tier or presentation). In a business sense, positive numbers reflect monthly capital gain, negative numbers, correspondingly, capital losses. This example is chosen because of one rather important application specific feature: typically, monthly losses for the investment portfolios do not exceed 100%, which mathematically means that (PFMi)=>-1 and correspondingly: (1+PFMi)=>0. It is quite a distant probability, that monthly losses could reach 100%, which means a financial disaster (all invested capital is lost), but please be aware, that theoretically monthly losses could reach or even exceed 100%; for example, in case when investment portfolio contains short positions or some type of exotic high-risk derivates. Anyway, this type of discussion belongs to the rather different subject matter (finance and investment) and goes far beyond the boundary and original intention of this article, which should focused primarily on the programming technique of SQL aggregate Product function. Therefore, based on the pre-condition that (PFMi)=>-1 will have SQL statement as shown in Listing 4.<br />
<h5>LISTING 4</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Year</span>, <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf([PFM]+1=0,0,<span style="color:Magenta;">Log</span>([PFM]+1))))*IIf(<span style="color:Magenta;">Min</span>([PFM]+1)=0,0,1)-1 <span style="color:Blue;">AS</span> Annual_PFM <span style="color:Blue;">FROM</span> Table2 <span style="color:Blue;">GROUP</span> <span style="color:Blue;">BY</span> <span style="color:Magenta;">Year</span>;
</pre></div>
<h4>4. SQL Aggregate Product function: Universal solution</h4>
Universal SQL aggregate Product function, capable of handling any positive, negative numbers and 0 (in other words, any real numbers) is shown in the Listing 6;<br />
<h5>LISTING 6</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf(<span style="color:Magenta;">Abs</span>([Num])=0,0,<span style="color:Magenta;">Log</span>(<span style="color:Magenta;">Abs</span>([Num])))))*IIf(<span style="color:Magenta;">Min</span>(<span style="color:Magenta;">Abs</span>([Num]))=0,0,1)*
(1-2*(<span style="color:Magenta;">Sum</span>(IIf([Num]>=0,0,1)) Mod 2)) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />This universal solution, encapsulated into this single SQL statement, contains three parts (multipliers). The first and the second are recognizable ones, which already have been discussed early in article (see Listing 3); they are capable of handling positive numbers and zeros. Third multiplier is added to take care of the sign by counting negative numbers, then dividing it by Modulo 2 and subtracting the doubled result value from 1. In simple words, it returns 1 for even count and -1 for odd count of all negatives, if any. <br />
<h4>4.1. Special handling of Null</h4>
The solutions for aggregate Product function discussed above, including the universal one, do not implement the implicit Null-to-value conversion, so any row containing Null will cause the procedure to fail, displaying the error message in Access database as “Data type mismatch in criteria expression”. This issue could be easily resolved by adding Null handling procedure, but the resolution could be application specific. Variable scenarios are listed below.<br /><br />a). Restrict rows from having Null values; for e.g., by adding constrains to the Table schema definition and/or Field level Validation object.<br /><br />b). Add Null-to-Zero conversion: NZ(<a href="https://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>) function can do the job. In this case any row containing Null will cause the aggregate Product function to return 0 regardless of the value in other rows.<br /><br />c). Add Null-to-1 conversion; for example, use the expression: IIF (<a href="https://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a> Is Null, 1, <a href="https://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>). In this case the aggregate Product function will return the product of all Non-Null row values.<br />
<h4>4.2. Performance-Universality consideration</h4>
In a context of this section performance means a speed of computation; not to be confused with investment performance discussed above. As the programmatic complexity of the universal solution (Listing 6) is higher than the simplified versions (Listing 1 and 3), then the performance of the universal SQL query will be lower comparing to that simplified ones. This is a classical example of performance-universality dilemma; decision should be made based on the compromise between these two competing metrics when choosing a solution to be adequate to the particular application. <br />
<h4>Summary</h4>
Suggested approach extends the capability of standard SQL by adding aggregate Product function. The whole solution is encapsulated into a single query, portable to many other SQL backed RDMB, for example, Microsoft SQL server; some syntactical differences could apply. Three versions, which differ in terms of their performance-universality matrix, are presented and discussed in details.<br />
<h5>OTHER ARTICLES BY AUTHOR:</h5>
<ol><li><b><a href="http://webinfocentral.com">Embedded YouTube™ video player</a></b></li>
<li><b><a href="http://webinfocentral.com/webtv">WebTV pilot project</a></b></li></ol>
<br />SQL | T-SQL | Product Function | Product Function SQL | Microsoft Access | Database | Query | Aggregate Function | Group By | Log | Exp | SQL Server | RDBM | BI | Data Layer| Business Logic |</div><div class="ClearBoth"></div>DrABELLWed, 18 Feb 2015 02:18:31 GMTUpdated Wiki: Home 20150218021831ASource code checked in, #16811http://productfunctionsql.codeplex.com/SourceControl/changeset/changes/16811Upgrade: New Version of LabDefaultTemplate.xaml. To upgrade your build definitions, please visit the following link: http://go.microsoft.com/fwlink/?LinkId=254563Project Collection Service AccountsMon, 01 Oct 2012 21:13:55 GMTSource code checked in, #16811 20121001091355PSource code checked in, #16810http://productfunctionsql.codeplex.com/SourceControl/changeset/changes/16810Checked in by server upgradeProject Collection Service AccountsMon, 01 Oct 2012 21:12:48 GMTSource code checked in, #16810 20121001091248PUpdated Wiki: Homehttp://productfunctionsql.codeplex.com/wikipage?version=4<div class="wikidoc"><b>Project Description</b><br />Suggested universal solutions extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function, portable to any SQL-backed databases.<br /><br />Entire “pure SQL” solution is encapsulated into a single query, portable to any SQL backed databases, for example, Microsoft Access or SQL server. Several solutions, which differ in terms of their performance-universality metrics, are presented and discussed. (Note: <b>refer to the working DEMO: Access Database file, attached to this project, containing sample data and queries, corresponding to the Listing 1...Listing 6)</b>
<h5>MORE READING ON SQL RECIPE BY AUTHOR:</h5>
<ol><li><b><a href="http://www.examiner.com/online-learning-in-new-york/aggregate-product-function-extends-sql" class="externalLink">Aggregate Product function extends SQL<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/sql-query-generates-large-data-sequence" class="externalLink">SQL generates large data sequence<span class="externalLinkIcon"></span></a></b></li></ol>
<h3>1. Key concept and definitions</h3>
<img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ProductFunctionSQL&DownloadId=148177" alt="SQL_Product_Function.jpg" title="SQL_Product_Function.jpg" /><br />In modern data-driven applications central database typically hosts a great deal of business logic, written in SQL. Pure SQL solutions have many practical advantages: they are native to any Database and as such, they are highly optimized and extremely effective in dealing with regular data sets; they are portable between all major commercially-available databases and are totally independent of the OS/platform. At least but not last: SQL was in place for many decades, and as such, its security vulnerability issues were pretty much identified and properly addressed. <br /><br />Alternative data-centric solutions, which involve in addition to SQL some other programming language (like C/C<u></u>, C#, VB, Java, etc.) could potentially raise the portability, performance, maintainability and application security issues; many of them are platform dependent, some of them are less efficient (especially those which do not produce the native compiled code) and each of them will inevitably add more security concerns and limitations because of their known/unknown security vulnerabilities. It’s also relevant to mention that the application maintenance and upgrade are less difficult when it’s core solution is mostly based on a single highly standardized and portable language such as SQL instead of being programmed with extended set of different (and in many cases – platform dependent) programming languages. Having all these considerations, SQL is in the core of any data-centric application.<br /><br />Standard SQL contains several aggregate functions (Sum, Count, Min, Max, etc) with pretty noticeable absent of aggregate Product. Just as a reminder, a Product function ∏ of multiple arguments (X1, X2 ,…, XN) is defined as:<br /><br />N<br />∏ (Xi) = X1 * X2 <b>….</b> XN …………………………..…………………............………………….......…………..(1)<br />i=1<br /><br />Database engine cannot perform the aggregate product calculation directly, but it can calculate sums. Simple mathematical transforms provide a workaround enabling to compute the product ∏ by using the standard built-in mathematical Log(), Exp() and SQL aggregated Sum() functions; the core technique is illustrated by mathematical formulas (2) and (3):<br /><br /><br />Log(X1 * X2 <b>….</b> XN) = Log(X1 ) <u> Log(X2) </u>… + Log(XN) …….………........….………….……(2)<br /><br />N N<br />∏(Xi )= Exp ( ∑ (Log(Xi))) ………………………….………………..................................…….…………….…(3)<br />i=1 i=1<br /><br />The last formula (3) could be programmatically translated into the equivalent SQL statement in a rather straightforward manner, enabling the calculation of aggregate Product by means of standard built-in SQL features.<br /><br />There is a certain practical limitation of using formulas (2) and (3): they provide an accurate solution applicable to any set of positive non-zero values (Xi), but this solution can not be applied directly to the negative values and zero (mathematical 0). The issue is rooted in the properties of a Log(Xi) function, which does not provide a real solution for negative numbers, plus, theoretically it should return a negative infinite value for zero input. While negative infinite is a quite common mathematical abstraction, it presents a programming challenge when translating into machine code. In order to extend formula (3) to cover the full range of positive, negative and zero-equal values, couple additional mathematical transforms must apply, namely:<br /><br />a). All negatives must be converted to positive numbers: standard Abs(Xi) function can do the job;<br /><br />b). The sign of the final expression (aggregate Product) must be defined. It could be done, for example, by counting of all negatives, then the “+” sign shall be assigned to the final expression for the even and “-“ for the odd count of negatives.<br /><br />c). The solution should implement a special handling of zeros. Quite ironically, though this case has rather simple logical solution (no computation actually needed: resulting Product must be 0 regardless of other row values) it causes some programmatic overhead, added to the SQL statement. There are couple solutions to this issue, which are discussed in greater details later in the article: one, though rather simple will cause additional methodical error rooted in the difference between “true negative infinite” in a pure mathematical sense and its approximate machine representation. Second solution will provide more accurate result by using the aggregate Min() function to detect zeros and, in case there any – to assign a zero value to the Product function output.<br />
<h3>2. Programming Technique: Math-to-SQL translation</h3>
Simplified Aggregate Product of all positive numbers: This simple yet practical example will demonstrate the SQL programming technique enabling to calculate the Product of all positive numbers {2, 4, 5, 7, 8} stored in a Microsoft Access Table1. Based on the precondition that there are no any negative values, simple SQL query can do the job of calculating Product (see its corresponding SQL statement shown in the Listing 1): Just run this query to get the accurate result of 2240 (∏ = 2<b>4</b>5<b>7</b>8 = 2240).<br />
<h5>LISTING 1</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(<span style="color:Magenta;">Log</span>([Num]))) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />The statement shown in Listing 1 is a direct SQL equivalent of the formula (3); it does not include any exception handling caused by negatives or zeros, so any of such values entered in Table1 will cause the SQL procedure to fail with error message “Invalid procedure call” (the explanation for this issue was already given in a previous discussion dedicated to the property of Log() function). The statement could be modified with IIf() conditional operator added in order to handle zeros (see Listing 2): <br />
<h5>LISTING 2</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(<span style="color:Magenta;">Log</span>(IIf([Num]=0,10^-306,[Num])))) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />The logic behind this statement is as follows: any time zero value is found the system instead of trying to calculate the Log(0) will replace zero value with extremely small positive number, for e.g. 10^(-306), close to machine 0. This simple approach has certain deficiency due to methodical error; the aggregate Product output is not exactly 0, moreover the actual result depends on other values in the rows. In many practical cases this error is relatively small and could fit the acceptable error budget. Fore more accurate calculation there is another solution with improved zero-value handling achieved through the use of conditional IIf() operator (see the corresponding SQL statement shown in the Listing 3):<br />
<h5>LISTING 3</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf([Num]=0,0,<span style="color:Magenta;">Log</span>([Num]))))*IIf(<span style="color:Magenta;">Min</span>([Num])=0,0,1) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />Additional multiplier IIf(Min(<a href="http://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>)=0,0,1) is added to the SQL statement in order to accurately “nullify” (set to 0) the return value of aggregate Product function in case at least one zero value was detected in any row. The first conditional operator is also modified, excluding 0 values from further processing (otherwise they will be converted to a small number and then passed to a Log() function). This measure allows to increase the overall computational efficiency; performance boost could be quite noticeable in case there are multiple rows in the Table1 containing zeros.<br /><br />Up to this point all discussed SQL solutions were able to calculate aggregate Product for positive numbers and zero. In the next section the universal solution will be introduced, extending the applicable range to cover negatives as well.<br />
<h4>3 Real-life example: investment performance calculation</h4>
The problem and resolution. This simple real-life example related to the investment performance calculation will serve both practical and didactical purposes, demonstrating the application of the SQL aggregate Product programming technique. Based on the commonly accepted practice, the compound annual performance (ANNUAL_PFM) of the financial investment portfolio could be calculated on the basis of its monthly performance array PFMi (i=1…12) as following:<br /><br />ANNUAL_PFM = (1+PFM1) *(1+ PFM2) *…*(1+PFM12) -1 .................................. (4)<br /><br />Similar approach is applicable to the Quarterly Performance (Q_PFM), Semi-Annual, 3-, 5- and 10 years performance calculation, etc. Programmatically, all this type of compound investment performance calculations could use the same Aggregate Product function and differ only by CROUP BY clause. Following two examples will demonstrate this technique in regards to Annual and Quarterly performance calculation. Sample Table2 in the supplement database contains some hypothetical XYZ portfolio monthly performance data entered for two consequent years, 2004 and 2005 (please notice, that all data in this article and corresponding downloads is shown for demonstration purpose only and does not represent any actual financial information).<br /><br />Investment performance is typically presented in a percent; here the numbers shown are stored as a relative values, provided that the conversion to percent could be done later on a different layers (mid-tier or presentation). In a business sense, positive numbers reflect monthly capital gain, negative numbers, correspondingly, capital losses. This example is chosen because of one rather important application specific feature: typically, monthly losses for the investment portfolios do not exceed 100%, which mathematically means that (PFMi)=>-1 and correspondingly: (1+PFMi)=>0. It is quite a distant probability, that monthly losses could reach 100%, which means a financial disaster (all invested capital is lost), but please be aware, that theoretically monthly losses could reach or even exceed 100%; for example, in case when investment portfolio contains short positions or some type of exotic high-risk derivates. Anyway, this type of discussion belongs to the rather different subject matter (finance and investment) and goes far beyond the boundary and original intention of this article, which should focused primarily on the programming technique of SQL aggregate Product function. Therefore, based on the pre-condition that (PFMi)=>-1 will have SQL statement as shown in Listing 4.<br />
<h5>LISTING 4</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Year</span>, <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf([PFM]+1=0,0,<span style="color:Magenta;">Log</span>([PFM]+1))))*IIf(<span style="color:Magenta;">Min</span>([PFM]+1)=0,0,1)-1 <span style="color:Blue;">AS</span> Annual_PFM <span style="color:Blue;">FROM</span> Table2 <span style="color:Blue;">GROUP</span> <span style="color:Blue;">BY</span> <span style="color:Magenta;">Year</span>;
</pre></div>
<h4>4. SQL Aggregate Product function: Universal solution</h4>
Universal SQL aggregate Product function, capable of handling any positive, negative numbers and 0 (in other words, any real numbers) is shown in the Listing 6;<br />
<h5>LISTING 6</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf(<span style="color:Magenta;">Abs</span>([Num])=0,0,<span style="color:Magenta;">Log</span>(<span style="color:Magenta;">Abs</span>([Num])))))*IIf(<span style="color:Magenta;">Min</span>(<span style="color:Magenta;">Abs</span>([Num]))=0,0,1)*
(1-2*(<span style="color:Magenta;">Sum</span>(IIf([Num]>=0,0,1)) Mod 2)) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />This universal solution, encapsulated into this single SQL statement, contains three parts (multipliers). The first and the second are recognizable ones, which already have been discussed early in article (see Listing 3); they are capable of handling positive numbers and zeros. Third multiplier is added to take care of the sign by counting negative numbers, then dividing it by Modulo 2 and subtracting the doubled result value from 1. In simple words, it returns 1 for even count and -1 for odd count of all negatives, if any. <br />
<h4>4.1. Special handling of Null</h4>
The solutions for aggregate Product function discussed above, including the universal one, do not implement the implicit Null-to-value conversion, so any row containing Null will cause the procedure to fail, displaying the error message in Access database as “Data type mismatch in criteria expression”. This issue could be easily resolved by adding Null handling procedure, but the resolution could be application specific. Variable scenarios are listed below.<br /><br />a). Restrict rows from having Null values; for e.g., by adding constrains to the Table schema definition and/or Field level Validation object.<br /><br />b). Add Null-to-Zero conversion: NZ(<a href="http://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>) function can do the job. In this case any row containing Null will cause the aggregate Product function to return 0 regardless of the value in other rows.<br /><br />c). Add Null-to-1 conversion; for example, use the expression: IIF (<a href="http://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a> Is Null, 1, <a href="http://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>). In this case the aggregate Product function will return the product of all Non-Null row values.<br />
<h4>4.2. Performance-Universality consideration</h4>
In a context of this section performance means a speed of computation; not to be confused with investment performance discussed above. As the programmatic complexity of the universal solution (Listing 6) is higher than the simplified versions (Listing 1 and 3), then the performance of the universal SQL query will be lower comparing to that simplified ones. This is a classical example of performance-universality dilemma; decision should be made based on the compromise between these two competing metrics when choosing a solution to be adequate to the particular application. <br />
<h4>Summary</h4>
Suggested approach extends the capability of standard SQL by adding aggregate Product function. The whole solution is encapsulated into a single query, portable to many other SQL backed RDMB, for example, Microsoft SQL server; some syntactical differences could apply. Three versions, which differ in terms of their performance-universality matrix, are presented and discussed in details.<br />
<h5>OTHER ARTICLES BY AUTHOR:</h5>
<ol><li><b><a href="http://www.examiner.com/examiner/x-24517-NY-Online-Learning-Examiner~y2010m3d5-Rich-internet-applications-part-1-embedding-YouTube-video-player-into-web-page" class="externalLink">Rich internet applications, part 1: embedding YouTube™ video player into web page<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/examiner/x-24517-NY-Online-Learning-Examiner~y2010m3d5-Rich-internet-applications-part-2-Silverlight-media-player" class="externalLink">Rich internet applications, part 2: Silverlight™ media player<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/examiner/x-24517-NY-Online-Learning-Examiner~y2010m3d18-Rich-internet-applications-part-3-HTML-5-video-player" class="externalLink">Rich internet applications, part 3: HTML 5 video player<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/how-to-select-web-browser-and-check-its-capabilities" class="externalLink">How to select web browser and check its capabilities<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/how-to-archive-and-back-up-your-online-content" class="externalLink">How to archive and back-up your online content<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/computer-mouse-triple-click-is-a-convenient-feature" class="externalLink">Computer mouse triple-click is a convenient feature<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/how-to-use-online-geocoders-and-interactive-maps" class="externalLink">How to use online geocoders and interactive maps<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/search-engine-optimization-and-online-concordance-calculator" class="externalLink">Search engine optimization and online concordance calculator<span class="externalLinkIcon"></span></a></b></li></ol>
<br />SQL | T-SQL | Product Function | Product Function SQL | Microsoft Access | Database | Query | Aggregate Function | Group By | Log | Exp | SQL Server | RDBM | BI | Data Layer| Business Logic |</div><div class="ClearBoth"></div>DrABELLSat, 04 Sep 2010 17:00:55 GMTUpdated Wiki: Home 20100904050055PUpdated Release: ProductFunctionSQL (Aug 31, 2010)http://productfunctionsql.codeplex.com/releases/view/51525<div class="wikidoc">Suggested approach extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function. Entire solution is encapsulated into a single query, portable to any SQL-backed databases, for example, Microsoft Access (attached).</div><div class="ClearBoth"></div>drabellTue, 31 Aug 2010 14:35:08 GMTUpdated Release: ProductFunctionSQL (Aug 31, 2010) 20100831023508PReleased: ProductFunctionSQL (Aug 31, 2010)http://productfunctionsql.codeplex.com/releases/view/51525<div class=wikidoc>Suggested approach extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function. Entire solution is encapsulated into a single query, portable to any SQL-backed databases, for example, Microsoft Access (attached).</div><div></div>Tue, 31 Aug 2010 14:35:08 GMTReleased: ProductFunctionSQL (Aug 31, 2010) 20100831023508PUpdated Wiki: Homehttp://productfunctionsql.codeplex.com/wikipage?version=3<div class="wikidoc"><b>Project Description</b><br />Suggested universal solutions extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function, portable to any SQL-backed databases.<br /><br />Entire “pure SQL” solution is encapsulated into a single query, portable to any SQL backed databases, for example, Microsoft Access or SQL server. Several solutions, which differ in terms of their performance-universality metrics, are presented and discussed. (Note: <b>refer to the working DEMO: Access Database file, attached to this project, containing sample data and queries, corresponding to the Listing 1...Listing 6)</b>
<h5>MORE READING ON SQL RECIPE BY AUTHOR:</h5>
<ol><li><b><a href="http://www.examiner.com/online-learning-in-new-york/aggregate-product-function-extends-sql" class="externalLink">Aggregate Product function extends SQL<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/sql-query-generates-large-data-sequence" class="externalLink">SQL generates large data sequence<span class="externalLinkIcon"></span></a></b></li></ol>
<h3>1. Key concept and definitions</h3>
In modern data-driven applications central database typically hosts a great deal of business logic, written in SQL. Pure SQL solutions have many practical advantages: they are native to any Database and as such, they are highly optimized and extremely effective in dealing with regular data sets; they are portable between all major commercially-available databases and are totally independent of the OS/platform. At least but not last: SQL was in place for many decades, and as such, its security vulnerability issues were pretty much identified and properly addressed. <br /><br />Alternative data-centric solutions, which involve in addition to SQL some other programming language (like C/C<u></u>, C#, VB, Java, etc.) could potentially raise the portability, performance, maintainability and application security issues; many of them are platform dependent, some of them are less efficient (especially those which do not produce the native compiled code) and each of them will inevitably add more security concerns and limitations because of their known/unknown security vulnerabilities. It’s also relevant to mention that the application maintenance and upgrade are less difficult when it’s core solution is mostly based on a single highly standardized and portable language such as SQL instead of being programmed with extended set of different (and in many cases – platform dependent) programming languages. Having all these considerations, SQL is in the core of any data-centric application.<br /><br />Standard SQL contains several aggregate functions (Sum, Count, Min, Max, etc) with pretty noticeable absent of aggregate Product. Just as a reminder, a Product function ∏ of multiple arguments (X1, X2 ,…, XN) is defined as:<br /><br />N<br />∏ (Xi) = X1 * X2 <b>….</b> XN …………………………..…………………............………………….......…………..(1)<br />i=1<br /><br />Database engine cannot perform the aggregate product calculation directly, but it can calculate sums. Simple mathematical transforms provide a workaround enabling to compute the product ∏ by using the standard built-in mathematical Log(), Exp() and SQL aggregated Sum() functions; the core technique is illustrated by mathematical formulas (2) and (3):<br /><br /><br />Log(X1 * X2 <b>….</b> XN) = Log(X1 ) <u> Log(X2) </u>… + Log(XN) …….………........….………….……(2)<br /><br />N N<br />∏(Xi )= Exp ( ∑ (Log(Xi))) ………………………….………………..................................…….…………….…(3)<br />i=1 i=1<br /><br />The last formula (3) could be programmatically translated into the equivalent SQL statement in a rather straightforward manner, enabling the calculation of aggregate Product by means of standard built-in SQL features.<br /><br />There is a certain practical limitation of using formulas (2) and (3): they provide an accurate solution applicable to any set of positive non-zero values (Xi), but this solution can not be applied directly to the negative values and zero (mathematical 0). The issue is rooted in the properties of a Log(Xi) function, which does not provide a real solution for negative numbers, plus, theoretically it should return a negative infinite value for zero input. While negative infinite is a quite common mathematical abstraction, it presents a programming challenge when translating into machine code. In order to extend formula (3) to cover the full range of positive, negative and zero-equal values, couple additional mathematical transforms must apply, namely:<br /><br />a). All negatives must be converted to positive numbers: standard Abs(Xi) function can do the job;<br /><br />b). The sign of the final expression (aggregate Product) must be defined. It could be done, for example, by counting of all negatives, then the “+” sign shall be assigned to the final expression for the even and “-“ for the odd count of negatives.<br /><br />c). The solution should implement a special handling of zeros. Quite ironically, though this case has rather simple logical solution (no computation actually needed: resulting Product must be 0 regardless of other row values) it causes some programmatic overhead, added to the SQL statement. There are couple solutions to this issue, which are discussed in greater details later in the article: one, though rather simple will cause additional methodical error rooted in the difference between “true negative infinite” in a pure mathematical sense and its approximate machine representation. Second solution will provide more accurate result by using the aggregate Min() function to detect zeros and, in case there any – to assign a zero value to the Product function output.<br />
<h3>2. Programming Technique: Math-to-SQL translation</h3>
Simplified Aggregate Product of all positive numbers: This simple yet practical example will demonstrate the SQL programming technique enabling to calculate the Product of all positive numbers {2, 4, 5, 7, 8} stored in a Microsoft Access Table1. Based on the precondition that there are no any negative values, simple SQL query can do the job of calculating Product (see its corresponding SQL statement shown in the Listing 1): Just run this query to get the accurate result of 2240 (∏ = 2<b>4</b>5<b>7</b>8 = 2240).<br />
<h5>LISTING 1</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(<span style="color:Magenta;">Log</span>([Num]))) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />The statement shown in Listing 1 is a direct SQL equivalent of the formula (3); it does not include any exception handling caused by negatives or zeros, so any of such values entered in Table1 will cause the SQL procedure to fail with error message “Invalid procedure call” (the explanation for this issue was already given in a previous discussion dedicated to the property of Log() function). The statement could be modified with IIf() conditional operator added in order to handle zeros (see Listing 2): <br />
<h5>LISTING 2</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(<span style="color:Magenta;">Log</span>(IIf([Num]=0,10^-306,[Num])))) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />The logic behind this statement is as follows: any time zero value is found the system instead of trying to calculate the Log(0) will replace zero value with extremely small positive number, for e.g. 10^(-306), close to machine 0. This simple approach has certain deficiency due to methodical error; the aggregate Product output is not exactly 0, moreover the actual result depends on other values in the rows. In many practical cases this error is relatively small and could fit the acceptable error budget. Fore more accurate calculation there is another solution with improved zero-value handling achieved through the use of conditional IIf() operator (see the corresponding SQL statement shown in the Listing 3):<br />
<h5>LISTING 3</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf([Num]=0,0,<span style="color:Magenta;">Log</span>([Num]))))*IIf(<span style="color:Magenta;">Min</span>([Num])=0,0,1) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />Additional multiplier IIf(Min(<a href="http://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>)=0,0,1) is added to the SQL statement in order to accurately “nullify” (set to 0) the return value of aggregate Product function in case at least one zero value was detected in any row. The first conditional operator is also modified, excluding 0 values from further processing (otherwise they will be converted to a small number and then passed to a Log() function). This measure allows to increase the overall computational efficiency; performance boost could be quite noticeable in case there are multiple rows in the Table1 containing zeros.<br /><br />Up to this point all discussed SQL solutions were able to calculate aggregate Product for positive numbers and zero. In the next section the universal solution will be introduced, extending the applicable range to cover negatives as well.<br />
<h4>3 Real-life example: investment performance calculation</h4>
The problem and resolution. This simple real-life example related to the investment performance calculation will serve both practical and didactical purposes, demonstrating the application of the SQL aggregate Product programming technique. Based on the commonly accepted practice, the compound annual performance (ANNUAL_PFM) of the financial investment portfolio could be calculated on the basis of its monthly performance array PFMi (i=1…12) as following:<br /><br />ANNUAL_PFM = (1+PFM1) *(1+ PFM2) *…*(1+PFM12) -1 .................................. (4)<br /><br />Similar approach is applicable to the Quarterly Performance (Q_PFM), Semi-Annual, 3-, 5- and 10 years performance calculation, etc. Programmatically, all this type of compound investment performance calculations could use the same Aggregate Product function and differ only by CROUP BY clause. Following two examples will demonstrate this technique in regards to Annual and Quarterly performance calculation. Sample Table2 in the supplement database contains some hypothetical XYZ portfolio monthly performance data entered for two consequent years, 2004 and 2005 (please notice, that all data in this article and corresponding downloads is shown for demonstration purpose only and does not represent any actual financial information).<br /><br />Investment performance is typically presented in a percent; here the numbers shown are stored as a relative values, provided that the conversion to percent could be done later on a different layers (mid-tier or presentation). In a business sense, positive numbers reflect monthly capital gain, negative numbers, correspondingly, capital losses. This example is chosen because of one rather important application specific feature: typically, monthly losses for the investment portfolios do not exceed 100%, which mathematically means that (PFMi)=>-1 and correspondingly: (1+PFMi)=>0. It is quite a distant probability, that monthly losses could reach 100%, which means a financial disaster (all invested capital is lost), but please be aware, that theoretically monthly losses could reach or even exceed 100%; for example, in case when investment portfolio contains short positions or some type of exotic high-risk derivates. Anyway, this type of discussion belongs to the rather different subject matter (finance and investment) and goes far beyond the boundary and original intention of this article, which should focused primarily on the programming technique of SQL aggregate Product function. Therefore, based on the pre-condition that (PFMi)=>-1 will have SQL statement as shown in Listing 4.<br />
<h5>LISTING 4</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Year</span>, <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf([PFM]+1=0,0,<span style="color:Magenta;">Log</span>([PFM]+1))))*IIf(<span style="color:Magenta;">Min</span>([PFM]+1)=0,0,1)-1 <span style="color:Blue;">AS</span> Annual_PFM <span style="color:Blue;">FROM</span> Table2 <span style="color:Blue;">GROUP</span> <span style="color:Blue;">BY</span> <span style="color:Magenta;">Year</span>;
</pre></div>
<h4>4. SQL Aggregate Product function: Universal solution</h4>
Universal SQL aggregate Product function, capable of handling any positive, negative numbers and 0 (in other words, any real numbers) is shown in the Listing 6;<br />
<h5>LISTING 6</h5>
<div style="color:Black;background-color:White;"><pre>
<span style="color:Blue;">SELECT</span> <span style="color:Magenta;">Exp</span>(<span style="color:Magenta;">Sum</span>(IIf(<span style="color:Magenta;">Abs</span>([Num])=0,0,<span style="color:Magenta;">Log</span>(<span style="color:Magenta;">Abs</span>([Num])))))*IIf(<span style="color:Magenta;">Min</span>(<span style="color:Magenta;">Abs</span>([Num]))=0,0,1)*
(1-2*(<span style="color:Magenta;">Sum</span>(IIf([Num]>=0,0,1)) Mod 2)) <span style="color:Blue;">AS</span> P <span style="color:Blue;">FROM</span> Table1
</pre></div><br />This universal solution, encapsulated into this single SQL statement, contains three parts (multipliers). The first and the second are recognizable ones, which already have been discussed early in article (see Listing 3); they are capable of handling positive numbers and zeros. Third multiplier is added to take care of the sign by counting negative numbers, then dividing it by Modulo 2 and subtracting the doubled result value from 1. In simple words, it returns 1 for even count and -1 for odd count of all negatives, if any. <br />
<h4>4.1. Special handling of Null</h4>
The solutions for aggregate Product function discussed above, including the universal one, do not implement the implicit Null-to-value conversion, so any row containing Null will cause the procedure to fail, displaying the error message in Access database as “Data type mismatch in criteria expression”. This issue could be easily resolved by adding Null handling procedure, but the resolution could be application specific. Variable scenarios are listed below.<br /><br />a). Restrict rows from having Null values; for e.g., by adding constrains to the Table schema definition and/or Field level Validation object.<br /><br />b). Add Null-to-Zero conversion: NZ(<a href="http://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>) function can do the job. In this case any row containing Null will cause the aggregate Product function to return 0 regardless of the value in other rows.<br /><br />c). Add Null-to-1 conversion; for example, use the expression: IIF (<a href="http://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a> Is Null, 1, <a href="http://productfunctionsql.codeplex.com/wikipage?title=Num&referringTitle=Home">Num</a>). In this case the aggregate Product function will return the product of all Non-Null row values.<br />
<h4>4.2. Performance-Universality consideration</h4>
In a context of this section performance means a speed of computation; not to be confused with investment performance discussed above. As the programmatic complexity of the universal solution (Listing 6) is higher than the simplified versions (Listing 1 and 3), then the performance of the universal SQL query will be lower comparing to that simplified ones. This is a classical example of performance-universality dilemma; decision should be made based on the compromise between these two competing metrics when choosing a solution to be adequate to the particular application. <br />
<h4>Summary</h4>
Suggested approach extends the capability of standard SQL by adding aggregate Product function. The whole solution is encapsulated into a single query, portable to many other SQL backed RDMB, for example, Microsoft SQL server; some syntactical differences could apply. Three versions, which differ in terms of their performance-universality matrix, are presented and discussed in details.<br />
<h5>OTHER ARTICLES BY AUTHOR:</h5>
<ol><li><b><a href="http://www.examiner.com/examiner/x-24517-NY-Online-Learning-Examiner~y2010m3d5-Rich-internet-applications-part-1-embedding-YouTube-video-player-into-web-page" class="externalLink">Rich internet applications, part 1: embedding YouTube™ video player into web page<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/examiner/x-24517-NY-Online-Learning-Examiner~y2010m3d5-Rich-internet-applications-part-2-Silverlight-media-player" class="externalLink">Rich internet applications, part 2: Silverlight™ media player<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/examiner/x-24517-NY-Online-Learning-Examiner~y2010m3d18-Rich-internet-applications-part-3-HTML-5-video-player" class="externalLink">Rich internet applications, part 3: HTML 5 video player<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/how-to-select-web-browser-and-check-its-capabilities" class="externalLink">How to select web browser and check its capabilities<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/how-to-archive-and-back-up-your-online-content" class="externalLink">How to archive and back-up your online content<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/computer-mouse-triple-click-is-a-convenient-feature" class="externalLink">Computer mouse triple-click is a convenient feature<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/how-to-use-online-geocoders-and-interactive-maps" class="externalLink">How to use online geocoders and interactive maps<span class="externalLinkIcon"></span></a></b></li>
<li><b><a href="http://www.examiner.com/online-learning-in-new-york/search-engine-optimization-and-online-concordance-calculator" class="externalLink">Search engine optimization and online concordance calculator<span class="externalLinkIcon"></span></a></b></li></ol>
<br />SQL | T-SQL | Product Function | Product Function SQL | Microsoft Access | Database | Query | Aggregate Function | Group By | Log | Exp | SQL Server | RDBM | BI | Data Layer| Business Logic |</div><div class="ClearBoth"></div>DrABELLTue, 31 Aug 2010 13:34:11 GMTUpdated Wiki: Home 20100831013411PUpdated Release: ProductFunctionSQL (Aug 31, 2010)http://productfunctionsql.codeplex.com/releases/view/51525<div class="wikidoc">Suggested approach extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function. Entire solution is encapsulated into a single query, portable to any SQL-backed databases, for example, Microsoft Access (attached).</div><div class="ClearBoth"></div>drabellTue, 31 Aug 2010 13:25:15 GMTUpdated Release: ProductFunctionSQL (Aug 31, 2010) 20100831012515PUpdated Release: ProductFunctionSQL (Aug 31, 2010)http://productfunctionsql.codeplex.com/releases/view/51525<div class="wikidoc">Suggested approach extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function. Entire solution is encapsulated into a single query, portable to any SQL-backed databases, for example, Microsoft Access (attached).</div><div class="ClearBoth"></div>drabellTue, 31 Aug 2010 13:21:09 GMTUpdated Release: ProductFunctionSQL (Aug 31, 2010) 20100831012109PUpdated Release: ProductFunctionSQLhttp://productfunctionsql.codeplex.com/releases/view/51525<div class="wikidoc">Suggested approach extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function. Entire solution is encapsulated into a single query, portable to any SQL-backed databases, for example, Microsoft Access (attached).</div><div class="ClearBoth"></div>drabellTue, 31 Aug 2010 13:19:06 GMTUpdated Release: ProductFunctionSQL 20100831011906PUpdated Release: ProductFunctionSQLhttp://productfunctionsql.codeplex.com/releases/view/51525<div class="wikidoc">Suggested approach extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function. Entire solution is encapsulated into a single query, portable to any SQL-backed databases, for example, Microsoft Access (attached).</div><div class="ClearBoth"></div>drabellTue, 31 Aug 2010 13:14:20 GMTUpdated Release: ProductFunctionSQL 20100831011420PUpdated Release: ProductFunctionSQLhttp://productfunctionsql.codeplex.com/releases/view/51525<div class="wikidoc">Suggested approach extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function. Entire solution is encapsulated into a single query, portable to any SQL-backed databases, for example, Microsoft Access (attached).</div><div class="ClearBoth"></div>drabellTue, 31 Aug 2010 13:13:22 GMTUpdated Release: ProductFunctionSQL 20100831011322PCreated Release: ProductFunctionSQLhttp://productfunctionsql.codeplex.com/releases?ReleaseId=51525<div class="wikidoc">Suggested approach extends the capability of standard Structured Query Language (SQL) by adding the Aggregate Product function. Entire solution is encapsulated into a single query, portable to any SQL-backed databases, for example, Microsoft Access (attached).</div><div class="ClearBoth"></div>drabellTue, 31 Aug 2010 13:12:52 GMTCreated Release: ProductFunctionSQL 20100831011252P