create table t1 (
pk int primary key,
a int,
b int
);
create table t2 (
pk int primary key,
a int,
b int,
c char(10)
);
insert into t2 values
( 1, 0, 1, 'one'),
( 2, 0, 2, 'two'),
( 3, 0, 3, 'three'),
( 4, 1, 1, 'one'),
( 5, 1, 1, 'two'),
( 6, 1, 2, 'three');
# First try some invalid queries.
select std(c) over (order by a)
from t2;
std(c) over (order by a) 0 0 0 0 0 0
# Empty frame.
select std(b) over (order by a rows between 2 following and1 following) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 2 following and1 following) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a rows between 1 preceding and2 preceding) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 1 preceding and2 preceding) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a rows between 1 following and0 following) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 1 following and0 following) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a rows between 1 following and0 preceding) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 1 following and0 preceding) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a rows between 0 following and1 preceding) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 0 following and1 preceding) as exp
from t2;
exp
NULL
NULL
NULL
NULL
NULL
NULL
# 1 row frame.
select std(b) over (order by a rows between current row and current row) as exp
from t2;
exp 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
select std(b) over (order by a rows between 0 preceding and current row) as exp
from t2;
exp 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
select std(b) over (order by a rows between 0 preceding and0 preceding) as exp
from t2;
exp 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
select std(b) over (order by a rows between 0 preceding and0 following) as exp
from t2;
exp 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
select std(b) over (order by a rows between 0 following and0 preceding) as exp from t2;
exp 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
select std(b) over (order by a rows between 0 following and current row) as exp
from t2; ERROR HY000: Unacceptable combination of window frame bound specifications
select std(b) over (order by a rows between current row and0 following) as exp
from t2;
exp 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
# Only peers frame.
select a, b, std(b) over (order by a range between 0 preceding and0 preceding) as exp
from t2;
a b exp 010.8165 020.8165 030.8165 110.4714 110.4714 120.4714
select a, b, std(b) over (order by a range between 0 preceding and current row) as exp
from t2;
a b exp 010.8165 020.8165 030.8165 110.4714 110.4714 120.4714
select a, b, std(b) over (order by a range between current row and0 preceding) as exp
from t2; ERROR HY000: Unacceptable combination of window frame bound specifications
select a, b, std(b) over (order by a range between current row and0 following) as exp
from t2;
a b exp 010.8165 020.8165 030.8165 110.4714 110.4714 120.4714
select a, b, std(b) over (order by a range between 0 following and0 following) as exp
from t2;
a b exp 010.8165 020.8165 030.8165 110.4714 110.4714 120.4714
# 2 rows frame.
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and current row) as exp
from t2;
pk a b exp 1010.0000 2020.5000 3030.5000 4111.0000 5110.0000 6120.5000
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and0 preceding) as exp
from t2;
pk a b exp 1010.0000 2020.5000 3030.5000 4111.0000 5110.0000 6120.5000
select pk, a, b, std(b) over (order by a, b, pk rows between current row and1 following) as exp
from t2;
pk a b exp 1010.5000 2020.5000 3031.0000 4110.0000 5110.5000 6120.0000
select pk, a, b, std(b) over (order by a, b, pk rows between 0 following and1 following) as exp
from t2;
pk a b exp 1010.5000 2020.5000 3031.0000 4110.0000 5110.5000 6120.0000
# 2 peers frame.
select pk, a, b, std(b) over (order by a range between 1 preceding and current row) as exp
from t2;
pk a b exp 1010.8165 2020.8165 3030.8165 4110.7454 5110.7454 6120.7454
select pk, a, b, std(b) over (order by a range between 1 preceding and0 preceding) as exp
from t2;
pk a b exp 1010.8165 2020.8165 3030.8165 4110.7454 5110.7454 6120.7454
select pk, a, b, std(b) over (order by a range between current row and1 following) as exp
from t2;
pk a b exp 1010.7454 2020.7454 3030.7454 4110.4714 5110.4714 6120.4714
select pk, a, b, std(b) over (order by a range between 0 following and1 following) as exp
from t2;
pk a b exp 1010.7454 2020.7454 3030.7454 4110.4714 5110.4714 6120.4714
drop table t1;
drop table t2;
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.