SlideShare a Scribd company logo
1 of 34
Download to read offline
Firebird 3 Windowing Functions




Firebird 3 Windowing Functions



  Author:   Philippe Makowski IBPhoenix
   Email:   pmakowski@ibphoenix
 Licence:   Public Documentation License
    Date:   2011-11-22




                Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

               What are Windowing Functions?
•   Similar to classical aggregates but does more!
•   Provides access to set of rows from the current row
•   Introduced SQL:2003 and more detail in SQL:2008
•   Supported by PostgreSQL, Oracle, SQL Server, Sybase and DB2
•   Used in OLAP mainly but also useful in OLTP
        • Analysis and reporting by rankings, cumulative aggregates




                           Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                 Windowed Table Functions
• Windowed table function
     • operates on a window of a table
     • returns a value for every row in that window
     • the value is calculated by taking into consideration values from the set of
       rows in that window
• 8 new windowed table functions
• In addition, old aggregate functions can also be used as windowed table
  functions
• Allows calculation of moving and cumulative aggregate values.




                         Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                                  A Window
• Represents set of rows that is used to compute additionnal attributes
• Based on three main concepts
     • partition
          • specified by PARTITION BY clause in OVER()
          • Allows to subdivide the table, much like GROUP BY clause
          • Without a PARTITION BY clause, the whole table is in a single partition
     • order
          • defines an order with a partition
          • may contain multiple order items
                • Each item includes a value-expression
                • NULLS FIRST/LAST defines ordering semantics for NULL
          • this clause is independant of the query's ORDER BY clause
     • frame (Firebird don't implement frame yet)

                          Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

             Window function syntax in Firebird
<window function> ::=
  <window function type> OVER <window specification>

<window function type> ::=
   <rank function type> <left paren> <right paren>
 | ROW_NUMBER <left paren> <right paren>
 | <aggregate function>
 | <lead or lag function>
 | <first or last value function>
 | <nth value function>

<rank function type> ::=
   RANK
 | DENSE_RANK




                            Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

             Window function syntax in Firebird
<lead or lag function> ::=
 <lead or lag> <left paren> <lead or lag extent>
    [ <comma> <offset> [ <comma> <default expression> ] ] <right paren>

<lead or lag> ::=
 LEAD | LAG

<lead or lag extent> ::=
 <value expression>

<offset> ::=
 <exact numeric literal>

<default expression> ::=
 <value expression>




                            Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

             Window function syntax in Firebird
<first or last value function> ::=
 <first or last value> <left paren> <value expression> <right paren>

<first or last value> ::=
 FIRST_VALUE | LAST_VALUE

<nth value function> ::=
 NTH_VALUE <left paren> <value expression> <comma> <nth row>
 <right paren>

<nth row> ::=
  <simple value specification>
| <dynamic parameter specification>
(must be an integer >= 1)




                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

         Window specification syntax in Firebird
<window specification> ::=
 <left paren> <window specification details> <right paren>

<window specification details> ::=
  [ <window partition clause> ]
  [ <window order clause> ]

<window partition clause> ::=
  PARTITION BY <window partition column reference or expression list>

<window partition column reference or expression list> ::=
 <window partition column reference or expression>
    [ { <comma> <window partition column reference or expression> }... ]

<window partition column reference or expression> ::=
 <column reference or expression> [ <collate clause> ]

<window order clause> ::=
  ORDER BY <sort specification list>



                           Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                                   About order
The window order clause is to calculate its values, and has nothing to do with the main
order.

 select emp_no, salary,
    sum(salary) over (order by salary) cum_salary,
    sum(salary) over (order by salary desc) cum_salary_desc
  from employee order by emp_no;
 EMP_NO                 SALARY           CUM_SALARY       CUM_SALARY_DESC
 ======= ===================== ===================== =====================
        2            105900.00            1990493.02          113637875.00
        4             97500.00            1680929.02          113939039.00
      28              22935.00              22935.00          115522468.02
     121           99000000.00          115522468.02           99000000.00
     145              32000.00             113210.00          115441258.02




                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                                   About order
If the main query doesn't have a order by but a window have, the query will be ordered
accordingly to the last window order.

 select emp_no, salary,
    sum(salary) over (order by salary) cum_salary,
    sum(salary) over (order by salary desc) cum_salary_desc
  from employee;
 EMP_NO                 SALARY           CUM_SALARY       CUM_SALARY_DESC
 ======= ===================== ===================== =====================
     121           99000000.00          115522468.02           99000000.00
     118            7480000.00           16522468.02          106480000.00
     110            6000000.00            9042468.02          112480000.00
     134             390500.00            3042468.02          112870500.00




                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                                 About order
select emp_no, salary,
   sum(salary) over (order by salary desc) cum_salary_desc,
   sum(salary) over (order by salary) cum_salary
 from employee;
EMP_NO                 SALARY      CUM_SALARY_DESC            CUM_SALARY
======= ===================== ===================== =====================
     28              22935.00          115522468.02              22935.00
    109              27000.00          115499533.02              49935.00
     65              31275.00          115472533.02              81210.00
    145              32000.00          115441258.02             113210.00




                           Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

             Set Functions as Window Functions
The OVER clause turns a set function into a window function
   • Aggregated value is computed per current row window

 select emp_no, dept_no, salary,
  avg(salary) over (partition by dept_no) as dept_avg
 from employee;
 EMP_NO DEPT_NO                SALARY              DEPT_AVG
 ======= ======= ===================== =====================
      12 000                  53793.00             133321.50
     105 000                 212850.00             133321.50
     127 100                  44000.00              77631.25
      85 100                 111262.50              77631.25
      34 110                  61637.81              65221.40
      61 110                  68805.00              65221.40
     110 115                6000000.00            6740000.00
     118 115                7480000.00            6740000.00




                            Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

             Set Functions as Window Functions
Who are the highest paid relatively compared with the department average?

 select emp_no, dept_no, salary,
   avg(salary) over (partition by dept_no) as dept_avg,
   salary - avg(salary) over (partition by dept_no) as diff
 from employee
 order by diff desc;
  EMP_NO DEPT_NO                 SALARY             DEPT_AVG                  DIFF
 ======= ======= ===================== ===================== =====================
     118 115                7480000.00            6740000.00             740000.00
     105 000                 212850.00             133321.50              79528.50
     107 670                 111262.50              71268.75              39993.75
       2 600                 105900.00              66450.00              39450.00
      85 100                 111262.50              77631.25              33631.25
       4 621                  97500.00              69184.87              28315.13
      46 900                 116100.00              92791.31              23308.69
       9 622                  75060.00              53409.16              21650.84




                            Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

               Built-in Windowing Functions
•   RANK () OVER ...
•   DENSE_RANK () OVER ...
•   LAG () OVER ...
•   LEAD () OVER ...
•   ROW_NUMBER () OVER ...
•   FIRST_VALUE () OVER ...
•   LAST_VALUES () OVER ...
•   NTH_VALUE () OVER ...




                       Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

       Built-in Windowing Functions : row_number
Returns number of the current row

 select emp_no, dept_no, salary,
 row_number() over (order by salary desc nulls last) as row_num
 from employee;
  EMP_NO DEPT_NO                 SALARY              ROW_NUM
 ======= ======= ===================== =====================
     121 125               99000000.00                     1
     118 115                7480000.00                     2
     110 115                6000000.00                     3
     134 123                 390500.00                     4
     105 000                 212850.00                     5
      46 900                 116100.00                     6
      85 100                 111262.50                     7
     107 670                 111262.50                     8
     141 121                 110000.00                     9


row_number() always incremented values independent of frame


                            Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

              Built-in Windowing Functions : rank
Returns rank of the current row with gap

 select emp_no, dept_no, salary,
 rank() over (order by salary desc nulls last) as rank
 from employee;
  EMP_NO DEPT_NO                 SALARY                 RANK
 ======= ======= ===================== =====================
     121 125               99000000.00                     1
     118 115                7480000.00                     2
     110 115                6000000.00                     3
     134 123                 390500.00                     4
     105 000                 212850.00                     5
      46 900                 116100.00                     6
      85 100                 111262.50                     7
     107 670                 111262.50                     7
     141 121                 110000.00                     9


rank() OVER(empty) returns 1 for all rows, since all rows are peers to each other


                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

        Built-in Windowing Functions : dense_rank
Returns rank of the current row without gap

 select emp_no, dept_no, salary,
 dense_rank() over (order by salary desc nulls last)
 from employee;
  EMP_NO DEPT_NO                 SALARY           DENSE_RANK
 ======= ======= ===================== =====================
     121 125               99000000.00                     1
     118 115                7480000.00                     2
     110 115                6000000.00                     3
     134 123                 390500.00                     4
     105 000                 212850.00                     5
      46 900                 116100.00                     6
      85 100                 111262.50                     7
     107 670                 111262.50                     7
     141 121                 110000.00                     8


dense_rank() OVER(empty) returns 1 for all rows, since all rows are peers to each
other

                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

  Built-in Windowing Functions : rank, dense_rank,
                    row_number
select emp_no, dept_no, salary,
 rank() over (order by salary desc nulls last),
 dense_rank() over (order by salary desc nulls last),
 row_number() over (order by salary desc nulls last)
from employee;
 EMP_NO DEPT_NO        SALARY    RANK    DENSE_RANK    ROW_NUMBER
======= ======= ============= ======= ============= =============
    121 125       99000000.00       1             1             1
    118 115        7480000.00       2             2             2
    110 115        6000000.00       3             3             3
    134 123         390500.00       4             4             4
    105 000         212850.00       5             5             5
     46 900         116100.00       6             6             6
     85 100         111262.50       7             7             7
    107 670         111262.50       7             7             8
    141 121         110000.00       9             8             9




                           Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

Missing Built-in Windowing Functions : percent_rank
Returns relative rank of the current row: (rank - 1) / (total rows - 1)
can be emulated with rank() and count()

 select emp_no, dept_no, salary,
  cast((rank() over (order by salary asc))-1 as double precision)
       / ( count(*) over () -1) as percent_rank
 from employee
  EMP_NO DEPT_NO                 SALARY           PERCENT_RANK
 ======= ======= ===================== =======================
      28 120                  22935.00       0.000000000000000
     109 600                  27000.00     0.02439024390243903
 ...
     144 672                  35000.00      0.1219512195121951
     114 623                  35000.00      0.1219512195121951
     138 621                  36000.00      0.1707317073170732
 ...
     118 115                7480000.00      0.9756097560975610
     121 125               99000000.00       1.000000000000000



                               Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

    Missing Built-in Windowing Functions : cum_dist
Returns relative rank; (# of preced. or peers) / (total row)
can be emulated with count()

 select emp_no, dept_no, salary,
   cast((count(*) over (order by salary asc)) as double precision)
        / ( COUNT(*) over () ) as cum_dist
 from employee
  EMP_NO DEPT_NO                 SALARY               CUM_DIST
 ======= ======= ===================== =======================
      28 120                  22935.00     0.02380952380952381
     109 600                  27000.00     0.04761904761904762
 ...
     144 672                  35000.00      0.1666666666666667
     114 623                  35000.00      0.1666666666666667
     138 621                  36000.00      0.1904761904761905
 ...
     118 115                7480000.00      0.9761904761904762
     121 125               99000000.00       1.000000000000000



                               Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

               Built-in Windowing Functions :
              first_value,nth_value,last_value


Warning
Note that first_value, last_value, and nth_value consider only the rows within
the "window frame", which by default contains the rows from the start of the
partition through the last peer of the current row.
And Firebird today don't allow you to change the frame definition.
This is likely to give unhelpful results for nth_value and particularly last_value.




                          Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

         Built-in Windowing Functions : first_value
Returns value of the first row in a window

 select emp_no, dept_no, salary,
   first_value(salary) over (order by salary desc nulls last) overall_max,
   first_value(salary) over (partition by dept_no order by salary desc nulls last) dept_max,
   first_value(salary) over (order by salary asc nulls last) overall_min,
   first_value(salary) over (partition by dept_no order by salary asc nulls last) dept_min
 from employee;
  EMP_NO DEPT_NO       SALARY OVERALL_MAX      DEPT_MAX OVERALL_MIN       DEPT_MIN
 ======= ======= ============ ============ ============ ============ ============
      12 000         53793.00 99000000.00     212850.00     22935.00      53793.00
     105 000        212850.00 99000000.00     212850.00     22935.00      53793.00
     127 100         44000.00 99000000.00     111262.50     22935.00      44000.00
      85 100        111262.50 99000000.00     111262.50     22935.00      44000.00
      34 110         61637.81 99000000.00      68805.00     22935.00      61637.81
      61 110         68805.00 99000000.00      68805.00     22935.00      61637.81
     110 115       6000000.00 99000000.00    7480000.00     22935.00   6000000.00
     118 115       7480000.00 99000000.00    7480000.00     22935.00   6000000.00
      28 120         22935.00 99000000.00      39224.06     22935.00      22935.00
      37 120         39224.06 99000000.00      39224.06     22935.00      22935.00
     121 125      99000000.00 99000000.00 99000000.00       22935.00 99000000.00



                               Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

         Built-in Windowing Functions : nth_value
Returns value of the nth row in a window

 select emp_no, dept_no, salary,
   nth_value(salary,2) over (partition by dept_no order by salary desc)
 from employee;
  EMP_NO DEPT_NO                 SALARY            NTH_VALUE
 ======= ======= ===================== =====================
     105 000                 212850.00                <null>
      12 000                  53793.00              53793.00
      85 100                 111262.50                <null>
     127 100                  44000.00              44000.00
      61 110                  68805.00                <null>
      34 110                  61637.81              61637.81
     118 115                7480000.00                <null>
     110 115                6000000.00            6000000.00
      37 120                  39224.06                <null>
      36 120                  33620.63              33620.63
      28 120                  22935.00              33620.63




                            Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

         Built-in Windowing Functions : last_value
Returns value of the last row in a window

 select emp_no, dept_no, salary,
    last_value(salary) over (partition by dept_no order by salary asc)
     from employee;
  EMP_NO DEPT_NO                 SALARY           LAST_VALUE
 ======= ======= ===================== =====================
      12 000                  53793.00              53793.00
     105 000                 212850.00             212850.00
     127 100                  44000.00              44000.00
      85 100                 111262.50             111262.50
      34 110                  61637.81              61637.81
      61 110                  68805.00              68805.00




                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

       Built-in Windowing Functions : lag and lead
Both LAG and LEAD functions have the same usage.

 LAG (value [,offset[, default]]) OVER ([query_partition_clause] order_by_clause)
 LEAD (value [,offset[, default]]) OVER ([query_partition_clause] order_by_clause)



   • value - Can be a column or a built-in function, except for other analytic functions.
   • offset - The number of rows preceeding/following the current row, from which the
     data is to be retrieved. The default value is 1.
   • default - The value returned if the offset is outside the scope of the window. The
     default value is NULL.




                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                 Built-in Windowing Functions : lag
Returns value of row above

 select emp_no, dept_no, salary,
  lag(salary) over (order by salary desc nulls last)
 from employee;
  EMP_NO DEPT_NO                 SALARY                  LAG
 ======= ======= ===================== =====================
     121 125               99000000.00                <null>
     118 115                7480000.00           99000000.00
     110 115                6000000.00            7480000.00
     134 123                 390500.00            6000000.00
     105 000                 212850.00             390500.00
      46 900                 116100.00             212850.00
      85 100                 111262.50             116100.00
     107 670                 111262.50             111262.50
     141 121                 110000.00             111262.50


lag() only acts on a partition.


                                  Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

               Built-in Windowing Functions : lead
Returns value of row below

 select emp_no, dept_no, salary,
  lead(salary) over (order by salary desc nulls last)
 from employee;
  EMP_NO DEPT_NO                 SALARY                 LEAD
 ======= ======= ===================== =====================
     121 125               99000000.00            7480000.00
     118 115                7480000.00            6000000.00
     110 115                6000000.00             390500.00
     134 123                 390500.00             212850.00
     105 000                 212850.00             116100.00
      46 900                 116100.00             111262.50
      85 100                 111262.50             111262.50
     107 670                 111262.50             110000.00
     141 121                 110000.00             105900.00
      28 120                  22935.00                <null>


lead() only acts on a partition.

                               Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                        Cumulative aggregates
The current row window is now restricted to all rows equal to or preceding the current
row within the current partition
   • Find the total sales per quarter, and cumulative sales in quarter order

 select order_year, order_quarter, sum(total_value) as q_sales,
  sum(sum(total_value)) over (partition by order_year order by order_quarter)
      as cum_sales_year
 from v_sales_q
 group by order_year, order_quarter;
 ORDER_YEAR ORDER_QUARTER                Q_SALES       CUM_SALES_YEAR
 ========== ============= ===================== =====================
      1992              3               2985.00              2985.00
      1992              4              72000.00             74985.00
      1993              1                648.00               648.00
      1993              2              20000.00             20648.00
      1993              3            1009643.04           1030291.04
      1993              4             699724.16           1730015.20
      1994              1             440590.83            440590.83



                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                                   Performance
List orders, quantity ordered and cumulative quantity ordered by day

  ORDER_DATE   PO_NUMBER QTY_ORDERED          QTY_CUMUL_DAY
 ===========   ========= ============ =====================
 1991-03-04    V91E0210            10                    10
 1992-07-26    V92J1003            15                    15
 1992-10-15    V92E0340             7                     7
 1992-10-15    V92F3004             3                    10
 1993-02-03    V9333005             2                     2
 1993-03-22    V93C0120             1                     1
 1993-04-27    V9333006             5                     5
 1993-08-01    V93H3009             3                     3
 1993-08-09    V9324200          1000                  1000
 1993-08-09    V93C0990            40                  1040




                              Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                                   Performance
Without window function

 SELECT ORDER_DATE, CUST_NO,QTY_ORDERED,
       (SELECT SUM(QTY_ORDERED)
        FROM   SALES AS Si
        WHERE Si.ORDER_DATE = S.ORDER_DATE
        AND Si.CUST_NO <= S.CUST_NO)
       AS QTY_CUMUL_DAY
 FROM   SALES AS S
 ORDER BY S.ORDER_DATE, S.CUST_NO



 PLAN (SI INDEX (RDB$FOREIGN25))
 PLAN SORT (S NATURAL)
 SALES 591 indexed reads
 SALES 33 non indexed reads




                            Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                                    Performance
With window function

 SELECT ORDER_DATE, PO_NUMBER,QTY_ORDERED,
       SUM(QTY_ORDERED)
       OVER (PARTITION BY ORDER_DATE
        ORDER BY PO_NUMBER)
       AS QTY_CUMUL_DAY
 FROM   SALES
 ORDER BY ORDER_DATE, PO_NUMBER



 PLAN SORT (SALES NATURAL)
 SALES 33 non indexed reads




                               Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

                                  Performance
And you can extend it nearly without cost

 SELECT ORDER_DATE, PO_NUMBER,QTY_ORDERED,
       SUM(QTY_ORDERED)
       OVER (PARTITION BY ORDER_DATE
        ORDER BY PO_NUMBER)
       AS QTY_CUMUL_DAY,
       SUM(QTY_ORDERED)
       OVER (PARTITION BY EXTRACT(YEAR FROM ORDER_DATE),EXTRACT(MONTH FROM ORDER_DATE)
        ORDER BY ORDER_DATE, PO_NUMBER)
       AS QTY_CUMUL_MONTH,
       SUM(QTY_ORDERED)
       OVER (PARTITION BY EXTRACT(YEAR FROM ORDER_DATE)
        ORDER BY ORDER_DATE, PO_NUMBER)
       AS QTY_CUMUL_YEAR
 FROM   SALES
 ORDER BY ORDER_DATE, PO_NUMBER




                             Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

PLAN SORT (SALES NATURAL)
SALES 33 non indexed reads



 ORDER_DATE   PO_NUMBER QTY_ORDERED QTY_CUMUL_DAY QTY_CUMUL_MONTH QTY_CUMUL_YEAR
===========   ========= =========== ============= =============== ==============
1991-03-04    V91E0210           10            10              10             10
1992-07-26    V92J1003           15            15              15             15
1992-10-15    V92E0340            7             7               7             22
1992-10-15    V92F3004            3            10              10             25
1993-02-03    V9333005            2             2               2              2
1993-03-22    V93C0120            1             1               1              3
1993-04-27    V9333006            5             5               5              8
1993-08-01    V93H3009            3             3               3             11
1993-08-09    V9324200         1000          1000            1003           1011
1993-08-09    V93C0990           40          1040            1043           1051
1993-08-16    V9324320            1             1            1044           1052
1993-08-20    V93J3100           16            16            1060           1068
1993-08-27    V93F3088           10            10            1070           1078




                              Philippe Makowski - IBPhoenix - 2011-11-22
Firebird 3 Windowing Functions

       Thank you !




 Philippe Makowski - IBPhoenix - 2011-11-22

More Related Content

What's hot

Performance Review Template
Performance Review TemplatePerformance Review Template
Performance Review TemplateDemand Metric
 
İş Modelinden İş Planına Geçerken
İş Modelinden İş Planına Geçerkenİş Modelinden İş Planına Geçerken
İş Modelinden İş Planına GeçerkenTufan Karaca
 
Rapport Developpement Carglass® 2017
Rapport Developpement Carglass® 2017Rapport Developpement Carglass® 2017
Rapport Developpement Carglass® 2017Sarah Pinto
 
Forced distribution method of performance appraisal
Forced distribution method of performance appraisalForced distribution method of performance appraisal
Forced distribution method of performance appraisalteddyhill62
 
Employee Engagement Reward And Recognition
Employee Engagement   Reward And RecognitionEmployee Engagement   Reward And Recognition
Employee Engagement Reward And RecognitionRanjit Das
 
Top 10 clinical nurse manager interview questions and answers
Top 10 clinical nurse manager interview questions and answersTop 10 clinical nurse manager interview questions and answers
Top 10 clinical nurse manager interview questions and answersladygaga21211
 
Genius intelligents
Genius intelligentsGenius intelligents
Genius intelligentsusavel
 

What's hot (8)

Performance Review Template
Performance Review TemplatePerformance Review Template
Performance Review Template
 
İş Modelinden İş Planına Geçerken
İş Modelinden İş Planına Geçerkenİş Modelinden İş Planına Geçerken
İş Modelinden İş Planına Geçerken
 
bio-data-1
bio-data-1bio-data-1
bio-data-1
 
Rapport Developpement Carglass® 2017
Rapport Developpement Carglass® 2017Rapport Developpement Carglass® 2017
Rapport Developpement Carglass® 2017
 
Forced distribution method of performance appraisal
Forced distribution method of performance appraisalForced distribution method of performance appraisal
Forced distribution method of performance appraisal
 
Employee Engagement Reward And Recognition
Employee Engagement   Reward And RecognitionEmployee Engagement   Reward And Recognition
Employee Engagement Reward And Recognition
 
Top 10 clinical nurse manager interview questions and answers
Top 10 clinical nurse manager interview questions and answersTop 10 clinical nurse manager interview questions and answers
Top 10 clinical nurse manager interview questions and answers
 
Genius intelligents
Genius intelligentsGenius intelligents
Genius intelligents
 

Viewers also liked

Initial review of Firebird 3
Initial review of Firebird 3Initial review of Firebird 3
Initial review of Firebird 3Mind The Firebird
 
Stored procedures in Firebird
Stored procedures in FirebirdStored procedures in Firebird
Stored procedures in FirebirdMind The Firebird
 
Resolving Firebird performance problems
Resolving Firebird performance problemsResolving Firebird performance problems
Resolving Firebird performance problemsAlexey Kovyazin
 
How Firebird transactions work
How Firebird transactions workHow Firebird transactions work
How Firebird transactions workMind The Firebird
 
Firebird 3: provider-based architecture, plugins and OO approach to API
Firebird 3: provider-based architecture, plugins and OO approach to API Firebird 3: provider-based architecture, plugins and OO approach to API
Firebird 3: provider-based architecture, plugins and OO approach to API Mind The Firebird
 
Creating logs for data auditing in FirebirdSQL
Creating logs for data auditing in FirebirdSQLCreating logs for data auditing in FirebirdSQL
Creating logs for data auditing in FirebirdSQLMind The Firebird
 
New SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad KhorsunNew SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad KhorsunMind The Firebird
 
Tips for using Firebird system tables
Tips for using Firebird system tablesTips for using Firebird system tables
Tips for using Firebird system tablesMind The Firebird
 
Life with big Firebird databases
Life with big Firebird databasesLife with big Firebird databases
Life with big Firebird databasesAlexey Kovyazin
 

Viewers also liked (11)

Initial review of Firebird 3
Initial review of Firebird 3Initial review of Firebird 3
Initial review of Firebird 3
 
Stored procedures in Firebird
Stored procedures in FirebirdStored procedures in Firebird
Stored procedures in Firebird
 
Resolving Firebird performance problems
Resolving Firebird performance problemsResolving Firebird performance problems
Resolving Firebird performance problems
 
How Firebird transactions work
How Firebird transactions workHow Firebird transactions work
How Firebird transactions work
 
Firebird 3: provider-based architecture, plugins and OO approach to API
Firebird 3: provider-based architecture, plugins and OO approach to API Firebird 3: provider-based architecture, plugins and OO approach to API
Firebird 3: provider-based architecture, plugins and OO approach to API
 
Creating logs for data auditing in FirebirdSQL
Creating logs for data auditing in FirebirdSQLCreating logs for data auditing in FirebirdSQL
Creating logs for data auditing in FirebirdSQL
 
Firebird
FirebirdFirebird
Firebird
 
New SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad KhorsunNew SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad Khorsun
 
SuperServer in Firebird 3
SuperServer in Firebird 3SuperServer in Firebird 3
SuperServer in Firebird 3
 
Tips for using Firebird system tables
Tips for using Firebird system tablesTips for using Firebird system tables
Tips for using Firebird system tables
 
Life with big Firebird databases
Life with big Firebird databasesLife with big Firebird databases
Life with big Firebird databases
 

Similar to Firebird 3 Windows Functions

College for Women Department of Information Science
College for Women  Department of Information Science  College for Women  Department of Information Science
College for Women Department of Information Science WilheminaRossi174
 
College for women department of information science
College for women  department of information science  College for women  department of information science
College for women department of information science AMMY30
 
Pygrunn 2012 down the rabbit - profiling in python
Pygrunn 2012   down the rabbit - profiling in pythonPygrunn 2012   down the rabbit - profiling in python
Pygrunn 2012 down the rabbit - profiling in pythonRemco Wendt
 
Enabling Applications with Informix' new OLAP functionality
 Enabling Applications with Informix' new OLAP functionality Enabling Applications with Informix' new OLAP functionality
Enabling Applications with Informix' new OLAP functionalityAjay Gupte
 
Down the rabbit hole, profiling in Django
Down the rabbit hole, profiling in DjangoDown the rabbit hole, profiling in Django
Down the rabbit hole, profiling in DjangoRemco Wendt
 
Olap Functions Suport in Informix
Olap Functions Suport in InformixOlap Functions Suport in Informix
Olap Functions Suport in InformixBingjie Miao
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testingsgleadow
 
SQL WORKSHOP::Lecture 9
SQL WORKSHOP::Lecture 9SQL WORKSHOP::Lecture 9
SQL WORKSHOP::Lecture 9Umair Amjad
 
Using R on Netezza
Using R on NetezzaUsing R on Netezza
Using R on NetezzaAjay Ohri
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesKeshav Murthy
 
SQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cSQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cRachelBarker26
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of SignalsCoding Academy
 
A New View of Database Views
A New View of Database ViewsA New View of Database Views
A New View of Database ViewsMichael Rosenblum
 
Bind Peeking - The Endless Tuning Nightmare
Bind Peeking - The Endless Tuning NightmareBind Peeking - The Endless Tuning Nightmare
Bind Peeking - The Endless Tuning NightmareSage Computing Services
 
XML features in DB2 11 for z/OS
XML features in DB2 11 for z/OSXML features in DB2 11 for z/OS
XML features in DB2 11 for z/OSJane Man
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan DirectivesFranck Pachot
 
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...Lucidworks
 

Similar to Firebird 3 Windows Functions (20)

College for Women Department of Information Science
College for Women  Department of Information Science  College for Women  Department of Information Science
College for Women Department of Information Science
 
College for women department of information science
College for women  department of information science  College for women  department of information science
College for women department of information science
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
Pygrunn 2012 down the rabbit - profiling in python
Pygrunn 2012   down the rabbit - profiling in pythonPygrunn 2012   down the rabbit - profiling in python
Pygrunn 2012 down the rabbit - profiling in python
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
Enabling Applications with Informix' new OLAP functionality
 Enabling Applications with Informix' new OLAP functionality Enabling Applications with Informix' new OLAP functionality
Enabling Applications with Informix' new OLAP functionality
 
Down the rabbit hole, profiling in Django
Down the rabbit hole, profiling in DjangoDown the rabbit hole, profiling in Django
Down the rabbit hole, profiling in Django
 
Olap Functions Suport in Informix
Olap Functions Suport in InformixOlap Functions Suport in Informix
Olap Functions Suport in Informix
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
 
SQL WORKSHOP::Lecture 9
SQL WORKSHOP::Lecture 9SQL WORKSHOP::Lecture 9
SQL WORKSHOP::Lecture 9
 
Using R on Netezza
Using R on NetezzaUsing R on Netezza
Using R on Netezza
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql Features
 
SQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cSQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19c
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
 
Angular 5
Angular 5Angular 5
Angular 5
 
A New View of Database Views
A New View of Database ViewsA New View of Database Views
A New View of Database Views
 
Bind Peeking - The Endless Tuning Nightmare
Bind Peeking - The Endless Tuning NightmareBind Peeking - The Endless Tuning Nightmare
Bind Peeking - The Endless Tuning Nightmare
 
XML features in DB2 11 for z/OS
XML features in DB2 11 for z/OSXML features in DB2 11 for z/OS
XML features in DB2 11 for z/OS
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan Directives
 
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
Art and Science Come Together When Mastering Relevance Ranking - Tom Burgmans...
 

More from Mind The Firebird

Using Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easilyUsing Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easilyMind The Firebird
 
A year in the life of Firebird .Net provider
A year in the life of Firebird .Net providerA year in the life of Firebird .Net provider
A year in the life of Firebird .Net providerMind The Firebird
 
Using ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceUsing ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceMind The Firebird
 
Firebird Performance counters in details
Firebird Performance counters in detailsFirebird Performance counters in details
Firebird Performance counters in detailsMind The Firebird
 
Understanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQLUnderstanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQLMind The Firebird
 
Threading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondThreading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondMind The Firebird
 
Orphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and LoggingOrphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and LoggingMind The Firebird
 
Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016Mind The Firebird
 
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...Mind The Firebird
 
Working with Large Firebird databases
Working with Large Firebird databasesWorking with Large Firebird databases
Working with Large Firebird databasesMind The Firebird
 
Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...Mind The Firebird
 
Continuous Database Monitoring with the Trace API
Continuous Database Monitoring with the Trace APIContinuous Database Monitoring with the Trace API
Continuous Database Monitoring with the Trace APIMind The Firebird
 
Firebird Conference 2011 - Introduction
Firebird Conference 2011 - IntroductionFirebird Conference 2011 - Introduction
Firebird Conference 2011 - IntroductionMind The Firebird
 
Firebird database recovery and protection for enterprises and ISV
Firebird database recovery and protection for enterprises and ISVFirebird database recovery and protection for enterprises and ISV
Firebird database recovery and protection for enterprises and ISVMind The Firebird
 
Migration from Firebird 1.5 to Firebird 2.5
Migration from Firebird 1.5 to Firebird 2.5Migration from Firebird 1.5 to Firebird 2.5
Migration from Firebird 1.5 to Firebird 2.5Mind The Firebird
 

More from Mind The Firebird (20)

Using Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easilyUsing Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easily
 
A year in the life of Firebird .Net provider
A year in the life of Firebird .Net providerA year in the life of Firebird .Net provider
A year in the life of Firebird .Net provider
 
Copycat presentation
Copycat presentationCopycat presentation
Copycat presentation
 
Using ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceUsing ТРСС to study Firebird performance
Using ТРСС to study Firebird performance
 
Overview of RedDatabase 2.5
Overview of RedDatabase 2.5Overview of RedDatabase 2.5
Overview of RedDatabase 2.5
 
Firebird Performance counters in details
Firebird Performance counters in detailsFirebird Performance counters in details
Firebird Performance counters in details
 
Understanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQLUnderstanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQL
 
Threading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondThreading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyond
 
Orphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and LoggingOrphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and Logging
 
Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016
 
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
 
Working with Large Firebird databases
Working with Large Firebird databasesWorking with Large Firebird databases
Working with Large Firebird databases
 
Firebird on Linux
Firebird on LinuxFirebird on Linux
Firebird on Linux
 
Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...
 
Firebird meets NoSQL
Firebird meets NoSQLFirebird meets NoSQL
Firebird meets NoSQL
 
Continuous Database Monitoring with the Trace API
Continuous Database Monitoring with the Trace APIContinuous Database Monitoring with the Trace API
Continuous Database Monitoring with the Trace API
 
Firebird Conference 2011 - Introduction
Firebird Conference 2011 - IntroductionFirebird Conference 2011 - Introduction
Firebird Conference 2011 - Introduction
 
Firebird database recovery and protection for enterprises and ISV
Firebird database recovery and protection for enterprises and ISVFirebird database recovery and protection for enterprises and ISV
Firebird database recovery and protection for enterprises and ISV
 
Migration from Firebird 1.5 to Firebird 2.5
Migration from Firebird 1.5 to Firebird 2.5Migration from Firebird 1.5 to Firebird 2.5
Migration from Firebird 1.5 to Firebird 2.5
 
A Bird and the Web
A Bird and the WebA Bird and the Web
A Bird and the Web
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Firebird 3 Windows Functions

  • 1. Firebird 3 Windowing Functions Firebird 3 Windowing Functions Author: Philippe Makowski IBPhoenix Email: pmakowski@ibphoenix Licence: Public Documentation License Date: 2011-11-22 Philippe Makowski - IBPhoenix - 2011-11-22
  • 2. Firebird 3 Windowing Functions What are Windowing Functions? • Similar to classical aggregates but does more! • Provides access to set of rows from the current row • Introduced SQL:2003 and more detail in SQL:2008 • Supported by PostgreSQL, Oracle, SQL Server, Sybase and DB2 • Used in OLAP mainly but also useful in OLTP • Analysis and reporting by rankings, cumulative aggregates Philippe Makowski - IBPhoenix - 2011-11-22
  • 3. Firebird 3 Windowing Functions Windowed Table Functions • Windowed table function • operates on a window of a table • returns a value for every row in that window • the value is calculated by taking into consideration values from the set of rows in that window • 8 new windowed table functions • In addition, old aggregate functions can also be used as windowed table functions • Allows calculation of moving and cumulative aggregate values. Philippe Makowski - IBPhoenix - 2011-11-22
  • 4. Firebird 3 Windowing Functions A Window • Represents set of rows that is used to compute additionnal attributes • Based on three main concepts • partition • specified by PARTITION BY clause in OVER() • Allows to subdivide the table, much like GROUP BY clause • Without a PARTITION BY clause, the whole table is in a single partition • order • defines an order with a partition • may contain multiple order items • Each item includes a value-expression • NULLS FIRST/LAST defines ordering semantics for NULL • this clause is independant of the query's ORDER BY clause • frame (Firebird don't implement frame yet) Philippe Makowski - IBPhoenix - 2011-11-22
  • 5. Firebird 3 Windowing Functions Window function syntax in Firebird <window function> ::= <window function type> OVER <window specification> <window function type> ::= <rank function type> <left paren> <right paren> | ROW_NUMBER <left paren> <right paren> | <aggregate function> | <lead or lag function> | <first or last value function> | <nth value function> <rank function type> ::= RANK | DENSE_RANK Philippe Makowski - IBPhoenix - 2011-11-22
  • 6. Firebird 3 Windowing Functions Window function syntax in Firebird <lead or lag function> ::= <lead or lag> <left paren> <lead or lag extent> [ <comma> <offset> [ <comma> <default expression> ] ] <right paren> <lead or lag> ::= LEAD | LAG <lead or lag extent> ::= <value expression> <offset> ::= <exact numeric literal> <default expression> ::= <value expression> Philippe Makowski - IBPhoenix - 2011-11-22
  • 7. Firebird 3 Windowing Functions Window function syntax in Firebird <first or last value function> ::= <first or last value> <left paren> <value expression> <right paren> <first or last value> ::= FIRST_VALUE | LAST_VALUE <nth value function> ::= NTH_VALUE <left paren> <value expression> <comma> <nth row> <right paren> <nth row> ::= <simple value specification> | <dynamic parameter specification> (must be an integer >= 1) Philippe Makowski - IBPhoenix - 2011-11-22
  • 8. Firebird 3 Windowing Functions Window specification syntax in Firebird <window specification> ::= <left paren> <window specification details> <right paren> <window specification details> ::= [ <window partition clause> ] [ <window order clause> ] <window partition clause> ::= PARTITION BY <window partition column reference or expression list> <window partition column reference or expression list> ::= <window partition column reference or expression> [ { <comma> <window partition column reference or expression> }... ] <window partition column reference or expression> ::= <column reference or expression> [ <collate clause> ] <window order clause> ::= ORDER BY <sort specification list> Philippe Makowski - IBPhoenix - 2011-11-22
  • 9. Firebird 3 Windowing Functions About order The window order clause is to calculate its values, and has nothing to do with the main order. select emp_no, salary, sum(salary) over (order by salary) cum_salary, sum(salary) over (order by salary desc) cum_salary_desc from employee order by emp_no; EMP_NO SALARY CUM_SALARY CUM_SALARY_DESC ======= ===================== ===================== ===================== 2 105900.00 1990493.02 113637875.00 4 97500.00 1680929.02 113939039.00 28 22935.00 22935.00 115522468.02 121 99000000.00 115522468.02 99000000.00 145 32000.00 113210.00 115441258.02 Philippe Makowski - IBPhoenix - 2011-11-22
  • 10. Firebird 3 Windowing Functions About order If the main query doesn't have a order by but a window have, the query will be ordered accordingly to the last window order. select emp_no, salary, sum(salary) over (order by salary) cum_salary, sum(salary) over (order by salary desc) cum_salary_desc from employee; EMP_NO SALARY CUM_SALARY CUM_SALARY_DESC ======= ===================== ===================== ===================== 121 99000000.00 115522468.02 99000000.00 118 7480000.00 16522468.02 106480000.00 110 6000000.00 9042468.02 112480000.00 134 390500.00 3042468.02 112870500.00 Philippe Makowski - IBPhoenix - 2011-11-22
  • 11. Firebird 3 Windowing Functions About order select emp_no, salary, sum(salary) over (order by salary desc) cum_salary_desc, sum(salary) over (order by salary) cum_salary from employee; EMP_NO SALARY CUM_SALARY_DESC CUM_SALARY ======= ===================== ===================== ===================== 28 22935.00 115522468.02 22935.00 109 27000.00 115499533.02 49935.00 65 31275.00 115472533.02 81210.00 145 32000.00 115441258.02 113210.00 Philippe Makowski - IBPhoenix - 2011-11-22
  • 12. Firebird 3 Windowing Functions Set Functions as Window Functions The OVER clause turns a set function into a window function • Aggregated value is computed per current row window select emp_no, dept_no, salary, avg(salary) over (partition by dept_no) as dept_avg from employee; EMP_NO DEPT_NO SALARY DEPT_AVG ======= ======= ===================== ===================== 12 000 53793.00 133321.50 105 000 212850.00 133321.50 127 100 44000.00 77631.25 85 100 111262.50 77631.25 34 110 61637.81 65221.40 61 110 68805.00 65221.40 110 115 6000000.00 6740000.00 118 115 7480000.00 6740000.00 Philippe Makowski - IBPhoenix - 2011-11-22
  • 13. Firebird 3 Windowing Functions Set Functions as Window Functions Who are the highest paid relatively compared with the department average? select emp_no, dept_no, salary, avg(salary) over (partition by dept_no) as dept_avg, salary - avg(salary) over (partition by dept_no) as diff from employee order by diff desc; EMP_NO DEPT_NO SALARY DEPT_AVG DIFF ======= ======= ===================== ===================== ===================== 118 115 7480000.00 6740000.00 740000.00 105 000 212850.00 133321.50 79528.50 107 670 111262.50 71268.75 39993.75 2 600 105900.00 66450.00 39450.00 85 100 111262.50 77631.25 33631.25 4 621 97500.00 69184.87 28315.13 46 900 116100.00 92791.31 23308.69 9 622 75060.00 53409.16 21650.84 Philippe Makowski - IBPhoenix - 2011-11-22
  • 14. Firebird 3 Windowing Functions Built-in Windowing Functions • RANK () OVER ... • DENSE_RANK () OVER ... • LAG () OVER ... • LEAD () OVER ... • ROW_NUMBER () OVER ... • FIRST_VALUE () OVER ... • LAST_VALUES () OVER ... • NTH_VALUE () OVER ... Philippe Makowski - IBPhoenix - 2011-11-22
  • 15. Firebird 3 Windowing Functions Built-in Windowing Functions : row_number Returns number of the current row select emp_no, dept_no, salary, row_number() over (order by salary desc nulls last) as row_num from employee; EMP_NO DEPT_NO SALARY ROW_NUM ======= ======= ===================== ===================== 121 125 99000000.00 1 118 115 7480000.00 2 110 115 6000000.00 3 134 123 390500.00 4 105 000 212850.00 5 46 900 116100.00 6 85 100 111262.50 7 107 670 111262.50 8 141 121 110000.00 9 row_number() always incremented values independent of frame Philippe Makowski - IBPhoenix - 2011-11-22
  • 16. Firebird 3 Windowing Functions Built-in Windowing Functions : rank Returns rank of the current row with gap select emp_no, dept_no, salary, rank() over (order by salary desc nulls last) as rank from employee; EMP_NO DEPT_NO SALARY RANK ======= ======= ===================== ===================== 121 125 99000000.00 1 118 115 7480000.00 2 110 115 6000000.00 3 134 123 390500.00 4 105 000 212850.00 5 46 900 116100.00 6 85 100 111262.50 7 107 670 111262.50 7 141 121 110000.00 9 rank() OVER(empty) returns 1 for all rows, since all rows are peers to each other Philippe Makowski - IBPhoenix - 2011-11-22
  • 17. Firebird 3 Windowing Functions Built-in Windowing Functions : dense_rank Returns rank of the current row without gap select emp_no, dept_no, salary, dense_rank() over (order by salary desc nulls last) from employee; EMP_NO DEPT_NO SALARY DENSE_RANK ======= ======= ===================== ===================== 121 125 99000000.00 1 118 115 7480000.00 2 110 115 6000000.00 3 134 123 390500.00 4 105 000 212850.00 5 46 900 116100.00 6 85 100 111262.50 7 107 670 111262.50 7 141 121 110000.00 8 dense_rank() OVER(empty) returns 1 for all rows, since all rows are peers to each other Philippe Makowski - IBPhoenix - 2011-11-22
  • 18. Firebird 3 Windowing Functions Built-in Windowing Functions : rank, dense_rank, row_number select emp_no, dept_no, salary, rank() over (order by salary desc nulls last), dense_rank() over (order by salary desc nulls last), row_number() over (order by salary desc nulls last) from employee; EMP_NO DEPT_NO SALARY RANK DENSE_RANK ROW_NUMBER ======= ======= ============= ======= ============= ============= 121 125 99000000.00 1 1 1 118 115 7480000.00 2 2 2 110 115 6000000.00 3 3 3 134 123 390500.00 4 4 4 105 000 212850.00 5 5 5 46 900 116100.00 6 6 6 85 100 111262.50 7 7 7 107 670 111262.50 7 7 8 141 121 110000.00 9 8 9 Philippe Makowski - IBPhoenix - 2011-11-22
  • 19. Firebird 3 Windowing Functions Missing Built-in Windowing Functions : percent_rank Returns relative rank of the current row: (rank - 1) / (total rows - 1) can be emulated with rank() and count() select emp_no, dept_no, salary, cast((rank() over (order by salary asc))-1 as double precision) / ( count(*) over () -1) as percent_rank from employee EMP_NO DEPT_NO SALARY PERCENT_RANK ======= ======= ===================== ======================= 28 120 22935.00 0.000000000000000 109 600 27000.00 0.02439024390243903 ... 144 672 35000.00 0.1219512195121951 114 623 35000.00 0.1219512195121951 138 621 36000.00 0.1707317073170732 ... 118 115 7480000.00 0.9756097560975610 121 125 99000000.00 1.000000000000000 Philippe Makowski - IBPhoenix - 2011-11-22
  • 20. Firebird 3 Windowing Functions Missing Built-in Windowing Functions : cum_dist Returns relative rank; (# of preced. or peers) / (total row) can be emulated with count() select emp_no, dept_no, salary, cast((count(*) over (order by salary asc)) as double precision) / ( COUNT(*) over () ) as cum_dist from employee EMP_NO DEPT_NO SALARY CUM_DIST ======= ======= ===================== ======================= 28 120 22935.00 0.02380952380952381 109 600 27000.00 0.04761904761904762 ... 144 672 35000.00 0.1666666666666667 114 623 35000.00 0.1666666666666667 138 621 36000.00 0.1904761904761905 ... 118 115 7480000.00 0.9761904761904762 121 125 99000000.00 1.000000000000000 Philippe Makowski - IBPhoenix - 2011-11-22
  • 21. Firebird 3 Windowing Functions Built-in Windowing Functions : first_value,nth_value,last_value Warning Note that first_value, last_value, and nth_value consider only the rows within the "window frame", which by default contains the rows from the start of the partition through the last peer of the current row. And Firebird today don't allow you to change the frame definition. This is likely to give unhelpful results for nth_value and particularly last_value. Philippe Makowski - IBPhoenix - 2011-11-22
  • 22. Firebird 3 Windowing Functions Built-in Windowing Functions : first_value Returns value of the first row in a window select emp_no, dept_no, salary, first_value(salary) over (order by salary desc nulls last) overall_max, first_value(salary) over (partition by dept_no order by salary desc nulls last) dept_max, first_value(salary) over (order by salary asc nulls last) overall_min, first_value(salary) over (partition by dept_no order by salary asc nulls last) dept_min from employee; EMP_NO DEPT_NO SALARY OVERALL_MAX DEPT_MAX OVERALL_MIN DEPT_MIN ======= ======= ============ ============ ============ ============ ============ 12 000 53793.00 99000000.00 212850.00 22935.00 53793.00 105 000 212850.00 99000000.00 212850.00 22935.00 53793.00 127 100 44000.00 99000000.00 111262.50 22935.00 44000.00 85 100 111262.50 99000000.00 111262.50 22935.00 44000.00 34 110 61637.81 99000000.00 68805.00 22935.00 61637.81 61 110 68805.00 99000000.00 68805.00 22935.00 61637.81 110 115 6000000.00 99000000.00 7480000.00 22935.00 6000000.00 118 115 7480000.00 99000000.00 7480000.00 22935.00 6000000.00 28 120 22935.00 99000000.00 39224.06 22935.00 22935.00 37 120 39224.06 99000000.00 39224.06 22935.00 22935.00 121 125 99000000.00 99000000.00 99000000.00 22935.00 99000000.00 Philippe Makowski - IBPhoenix - 2011-11-22
  • 23. Firebird 3 Windowing Functions Built-in Windowing Functions : nth_value Returns value of the nth row in a window select emp_no, dept_no, salary, nth_value(salary,2) over (partition by dept_no order by salary desc) from employee; EMP_NO DEPT_NO SALARY NTH_VALUE ======= ======= ===================== ===================== 105 000 212850.00 <null> 12 000 53793.00 53793.00 85 100 111262.50 <null> 127 100 44000.00 44000.00 61 110 68805.00 <null> 34 110 61637.81 61637.81 118 115 7480000.00 <null> 110 115 6000000.00 6000000.00 37 120 39224.06 <null> 36 120 33620.63 33620.63 28 120 22935.00 33620.63 Philippe Makowski - IBPhoenix - 2011-11-22
  • 24. Firebird 3 Windowing Functions Built-in Windowing Functions : last_value Returns value of the last row in a window select emp_no, dept_no, salary, last_value(salary) over (partition by dept_no order by salary asc) from employee; EMP_NO DEPT_NO SALARY LAST_VALUE ======= ======= ===================== ===================== 12 000 53793.00 53793.00 105 000 212850.00 212850.00 127 100 44000.00 44000.00 85 100 111262.50 111262.50 34 110 61637.81 61637.81 61 110 68805.00 68805.00 Philippe Makowski - IBPhoenix - 2011-11-22
  • 25. Firebird 3 Windowing Functions Built-in Windowing Functions : lag and lead Both LAG and LEAD functions have the same usage. LAG (value [,offset[, default]]) OVER ([query_partition_clause] order_by_clause) LEAD (value [,offset[, default]]) OVER ([query_partition_clause] order_by_clause) • value - Can be a column or a built-in function, except for other analytic functions. • offset - The number of rows preceeding/following the current row, from which the data is to be retrieved. The default value is 1. • default - The value returned if the offset is outside the scope of the window. The default value is NULL. Philippe Makowski - IBPhoenix - 2011-11-22
  • 26. Firebird 3 Windowing Functions Built-in Windowing Functions : lag Returns value of row above select emp_no, dept_no, salary, lag(salary) over (order by salary desc nulls last) from employee; EMP_NO DEPT_NO SALARY LAG ======= ======= ===================== ===================== 121 125 99000000.00 <null> 118 115 7480000.00 99000000.00 110 115 6000000.00 7480000.00 134 123 390500.00 6000000.00 105 000 212850.00 390500.00 46 900 116100.00 212850.00 85 100 111262.50 116100.00 107 670 111262.50 111262.50 141 121 110000.00 111262.50 lag() only acts on a partition. Philippe Makowski - IBPhoenix - 2011-11-22
  • 27. Firebird 3 Windowing Functions Built-in Windowing Functions : lead Returns value of row below select emp_no, dept_no, salary, lead(salary) over (order by salary desc nulls last) from employee; EMP_NO DEPT_NO SALARY LEAD ======= ======= ===================== ===================== 121 125 99000000.00 7480000.00 118 115 7480000.00 6000000.00 110 115 6000000.00 390500.00 134 123 390500.00 212850.00 105 000 212850.00 116100.00 46 900 116100.00 111262.50 85 100 111262.50 111262.50 107 670 111262.50 110000.00 141 121 110000.00 105900.00 28 120 22935.00 <null> lead() only acts on a partition. Philippe Makowski - IBPhoenix - 2011-11-22
  • 28. Firebird 3 Windowing Functions Cumulative aggregates The current row window is now restricted to all rows equal to or preceding the current row within the current partition • Find the total sales per quarter, and cumulative sales in quarter order select order_year, order_quarter, sum(total_value) as q_sales, sum(sum(total_value)) over (partition by order_year order by order_quarter) as cum_sales_year from v_sales_q group by order_year, order_quarter; ORDER_YEAR ORDER_QUARTER Q_SALES CUM_SALES_YEAR ========== ============= ===================== ===================== 1992 3 2985.00 2985.00 1992 4 72000.00 74985.00 1993 1 648.00 648.00 1993 2 20000.00 20648.00 1993 3 1009643.04 1030291.04 1993 4 699724.16 1730015.20 1994 1 440590.83 440590.83 Philippe Makowski - IBPhoenix - 2011-11-22
  • 29. Firebird 3 Windowing Functions Performance List orders, quantity ordered and cumulative quantity ordered by day ORDER_DATE PO_NUMBER QTY_ORDERED QTY_CUMUL_DAY =========== ========= ============ ===================== 1991-03-04 V91E0210 10 10 1992-07-26 V92J1003 15 15 1992-10-15 V92E0340 7 7 1992-10-15 V92F3004 3 10 1993-02-03 V9333005 2 2 1993-03-22 V93C0120 1 1 1993-04-27 V9333006 5 5 1993-08-01 V93H3009 3 3 1993-08-09 V9324200 1000 1000 1993-08-09 V93C0990 40 1040 Philippe Makowski - IBPhoenix - 2011-11-22
  • 30. Firebird 3 Windowing Functions Performance Without window function SELECT ORDER_DATE, CUST_NO,QTY_ORDERED, (SELECT SUM(QTY_ORDERED) FROM SALES AS Si WHERE Si.ORDER_DATE = S.ORDER_DATE AND Si.CUST_NO <= S.CUST_NO) AS QTY_CUMUL_DAY FROM SALES AS S ORDER BY S.ORDER_DATE, S.CUST_NO PLAN (SI INDEX (RDB$FOREIGN25)) PLAN SORT (S NATURAL) SALES 591 indexed reads SALES 33 non indexed reads Philippe Makowski - IBPhoenix - 2011-11-22
  • 31. Firebird 3 Windowing Functions Performance With window function SELECT ORDER_DATE, PO_NUMBER,QTY_ORDERED, SUM(QTY_ORDERED) OVER (PARTITION BY ORDER_DATE ORDER BY PO_NUMBER) AS QTY_CUMUL_DAY FROM SALES ORDER BY ORDER_DATE, PO_NUMBER PLAN SORT (SALES NATURAL) SALES 33 non indexed reads Philippe Makowski - IBPhoenix - 2011-11-22
  • 32. Firebird 3 Windowing Functions Performance And you can extend it nearly without cost SELECT ORDER_DATE, PO_NUMBER,QTY_ORDERED, SUM(QTY_ORDERED) OVER (PARTITION BY ORDER_DATE ORDER BY PO_NUMBER) AS QTY_CUMUL_DAY, SUM(QTY_ORDERED) OVER (PARTITION BY EXTRACT(YEAR FROM ORDER_DATE),EXTRACT(MONTH FROM ORDER_DATE) ORDER BY ORDER_DATE, PO_NUMBER) AS QTY_CUMUL_MONTH, SUM(QTY_ORDERED) OVER (PARTITION BY EXTRACT(YEAR FROM ORDER_DATE) ORDER BY ORDER_DATE, PO_NUMBER) AS QTY_CUMUL_YEAR FROM SALES ORDER BY ORDER_DATE, PO_NUMBER Philippe Makowski - IBPhoenix - 2011-11-22
  • 33. Firebird 3 Windowing Functions PLAN SORT (SALES NATURAL) SALES 33 non indexed reads ORDER_DATE PO_NUMBER QTY_ORDERED QTY_CUMUL_DAY QTY_CUMUL_MONTH QTY_CUMUL_YEAR =========== ========= =========== ============= =============== ============== 1991-03-04 V91E0210 10 10 10 10 1992-07-26 V92J1003 15 15 15 15 1992-10-15 V92E0340 7 7 7 22 1992-10-15 V92F3004 3 10 10 25 1993-02-03 V9333005 2 2 2 2 1993-03-22 V93C0120 1 1 1 3 1993-04-27 V9333006 5 5 5 8 1993-08-01 V93H3009 3 3 3 11 1993-08-09 V9324200 1000 1000 1003 1011 1993-08-09 V93C0990 40 1040 1043 1051 1993-08-16 V9324320 1 1 1044 1052 1993-08-20 V93J3100 16 16 1060 1068 1993-08-27 V93F3088 10 10 1070 1078 Philippe Makowski - IBPhoenix - 2011-11-22
  • 34. Firebird 3 Windowing Functions Thank you ! Philippe Makowski - IBPhoenix - 2011-11-22