Details
Description
create table t1(i int); |
insert into t1 values (1),(2),(3),(4),(5); |
|
select stddev_samp(i) from t1; |
create view v1 as select stddev_samp(i) from t1; |
select * from v1; |
MariaDB [test]> select stddev_samp(i) from t1;
|
+----------------+
|
| stddev_samp(i) |
|
+----------------+
|
| 1.5811 |
|
+----------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [test]> create or replace view v1 as select stddev_samp(i) from t1;
|
Query OK, 0 rows affected (0.009 sec)
|
|
MariaDB [test]> select * from v1;
|
+----------------+
|
| stddev_samp(i) |
|
+----------------+
|
| 1.4142 |
|
+----------------+
|
1 row in set (0.002 sec)
|
And with window function:
create table t1(i int); |
insert into t1 values (1),(2),(3),(4),(5); |
|
select stddev_samp(i) over (order by i) from t1; |
create view v1 as select stddev_samp(i) over (order by i) from t1; |
select * from v1; |
MariaDB [test]> select stddev_samp(i) over (order by i) from t1;
|
+----------------------------------+
|
| stddev_samp(i) over (order by i) |
|
+----------------------------------+
|
| NULL |
|
| 0.7071 |
|
| 1.0000 |
|
| 1.2910 |
|
| 1.5811 |
|
+----------------------------------+
|
5 rows in set (0.002 sec)
|
|
MariaDB [test]> create view v1 as select stddev_samp(i) over (order by i) from t1;
|
Query OK, 0 rows affected (0.007 sec)
|
|
MariaDB [test]> select * from v1;
|
+----------------------------------+
|
| stddev_samp(i) over (order by i) |
|
+----------------------------------+
|
| 0.0000 |
|
| 0.5000 |
|
| 0.8165 |
|
| 1.1180 |
|
| 1.4142 |
|
+----------------------------------+
|
5 rows in set (0.003 sec)
|
|