Posts

Showing posts from July, 2017

MySQL 8.0.2 Windows Function

Q : What is sql windows function  ? Ans  : a windows sql function will perform aggregation for each row in result set  , letting  each row in  the result set , leatting each row retain its identity . Example  : mysql> CREATE TABLE t(i INT); mysql> INSERT INTO t VALUES (1),(2),(3),(4); mysql> SELECT SUM(i) AS sum FROM t; +------+ | sum  | +------+ |   10 | +------+ mysql> SELECT i, SUM(i) OVER () AS sum FROM t; +------+------+ | i    | sum  | +------+------+ |    1 |   10 | |    2 |   10 | |    3 |   10 | |    4 |   10 | So  you can see only by  using over()  windows function  , sum is showing along with  each value that  has been summed . Q: what are types of windows sql function  ? Ans :  sql aggregate function can be used in two ways  :             A: -  Windows Function .             B:  -    Specialized window function .        A: windows function  :  count ,sum avg, min ,max , BIT_OR ,BIT_AND ,BIT_XOR           ,ST