1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| create table ST_station
( ST_ident integer auto_increment primary key
, ST_nom varchar(50) not null
, ST_alt dec(5,1) not null
)
;
insert into ST_station (ST_nom, ST_alt)
values ('ST1', 1020), ('ST2', 2400), ('ST3', 1234), ('ST4', 1080)
, ('ST5', 2345), ('ST6', 2380), ('ST7', 2810), ('ST8', 2825)
, ('ST9', 1288), ('STA', 2980), ('STB', 3018), ('STC', 3082)
, ('STD', 4025), ('STE', 3088), ('STF', 4034), ('STG', 4703)
, ('STH', 1108), ('STI', 2811), ('STJ', 4096), ('STK', 2887)
;
with tab1 (C1, C2) as
(select ST_nom
, round(ST_alt / 100)
from ST_station
)
select C2 * 100 as plage
, count(*) as nbr
from tab1
group by C2
order by C2
; |
Partager