REGR_SYY(expr1, expr2): For sum of squares : REGR_SYY « Analytical Functions « Oracle PL / SQL






REGR_SYY(expr1, expr2): For sum of squares



SQL>
SQL>
SQL> create table TestTable (
  2    x    number primary key,
  3    y    number
  4  );

Table created.

SQL> insert into TestTable values (1, 7 );

1 row created.

SQL> insert into TestTable values (2, 1 );

1 row created.

SQL> insert into TestTable values (3, 2 );

1 row created.

SQL> insert into TestTable values (4, 5 );

1 row created.

SQL> insert into TestTable values (5, 7 );

1 row created.

SQL> insert into TestTable values (6, 34 );

1 row created.

SQL> insert into TestTable values (7, 32 );

1 row created.

SQL> insert into TestTable values (8, 43 );

1 row created.

SQL> insert into TestTable values (9, 87 );

1 row created.

SQL>
SQL> select * from TestTable;

         X          Y
---------- ----------
         1          7
         2          1
         3          2
         4          5
         5          7
         6         34
         7         32
         8         43
         9         87

9 rows selected.

SQL>
SQL> --REGR_SYY(expr1, expr2): For sum of squares
SQL>
SQL> --REGR_SYY(expr1, expr2)
SQL>
SQL> SELECT REGR_SYY(y, x) FROM TestTable;

REGR_SYY(Y,X)
-------------
   6445.55556

SQL>
SQL> drop table TestTable;

Table dropped.

SQL>
SQL>
SQL>
SQL>
           
       








Related examples in the same category

1.REGR_SYY(y, x) Returns REG_COUNT(y, x) * VAR_POP(y)
2.REGR_AVGY(y, x) Returns the average of y after eliminating x and y pairs where either x or y is null