add batch
remove batch
split batch
comment selection
show hidden batches
hide batch
highlight batch
db<>fiddle
Db2
Firebird
MariaDB
MySQL
Node.js
Oracle
Postgres
SQLite
SQL Server
TimescaleDB
YugabyteDB
Developer-C 11.1
3.0
4.0
10.2
10.3
10.4
10.5
10.6
10.7
10.8
10.9
5.5
5.6
5.7
8.0
18
11g Release 2
18c
21c
23c
8.4
9.3
9.4
9.5
9.6
10
11
12
13
14
15
16
3.8
3.16
3.27
3.39
2012
2014
2016
2017
2017 (Linux)
2019
2019 (Linux)
2022
2.11
2.6
2.8
2.18
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
Sakila
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
no sample DB
AdventureWorks
no sample DB
no sample DB
AdventureWorks
no sample DB
no sample DB
no sample DB
no sample DB
run
markdown
donate
feedback
about
By using db<>fiddle, you agree to license everything you submit by
Creative Commons CC0
.
CREATE TABLE Whatever ( ZONSTS VARCHAR(10), ALLSTS INT, DPLSTS INT, CODPAL BIGINT, NUMPAL INT ); INSERT INTO Whatever (ZONSTS, ALLSTS, DPLSTS, CODPAL, NUMPAL) VALUES('Y', 20, 0, 100000000068261815, 15408139), ('Y', 20, 0, 100000000068261822, 15408141), ('Y', 20, 0, 100000000068261839, 15408142), ('Y', 20, 0, 100000000068261846, 15408143), ('Y', 20, 0, 100000000068261853, 15408144), ('Y', 20, 0, 100000000068261860, 15408145), ('Y', 20, 0, 100000000068261877, 15408148), ('Y', 9, 0, 100000000068247963, 15408149), ('Y', 9, 0, 100000000068247956, 15408150), ('Y', 9, 0, 100000000068247949, 15408151), ('Y', 9, 0, 100000000068247932, 15408152), ('Y', 9, 0, 100000000068247925, 15408153), ('Y', 9, 0, 100000000068247918, 15408154), ('Y', 20, 0, 100000000068261884, 15408155), ('Y', 9, 0, 100000000068247901, 15408156), ('Y', 9, 0, 100000000068247895, 15408157), ('Y', 9, 0, 100000000068247888, 15408158), ('Y', 20, 0, 100000000068261891, 15408159), ('Y', 9, 0, 100000000068247871, 15408160), ('Y', 9, 0, 100000000068247864, 15408161), ('Y', 9, 0, 100000000068247857, 15408162), ('Y', 9, 0, 100000000068247833, 15408163), ('Y', 20, 0, 100000000068261907, 15408164), ('Y', 9, 0, 100000000068247819, 15408166), ('Y', 9, 0, 100000000068247796, 15408167), ('Y', 9, 0, 100000000068247772, 15408168), ('Y', 20, 0, 100000000068261914, 15408169), ('Y', 9, 0, 100000000068247789, 15408171), ('Y', 20, 0, 100000000068261921, 15408172), ('Y', 20, 0, 100000000068261938, 15408173), ('Y', 20, 0, 100000000068263154, 15408175), ('Y', 20, 0, 100000000068263161, 15408177);
32 rows affected
SELECT ZONSTS, ALLSTS, ROW_NUMBER() OVER(PARTITION BY ALLSTS ORDER BY NUMPAL) AS RN, COUNT(ALLSTS) OVER(PARTITION BY ALLSTS) CNT, DPLSTS, CODPAL, NUMPAL FROM WHatever;
ZONSTS
ALLSTS
RN
CNT
DPLSTS
CODPAL
NUMPAL
Y
9
1
17
0
100000000068247963
15408149
Y
9
2
17
0
100000000068247956
15408150
Y
9
3
17
0
100000000068247949
15408151
Y
9
4
17
0
100000000068247932
15408152
Y
9
5
17
0
100000000068247925
15408153
Y
9
6
17
0
100000000068247918
15408154
Y
9
7
17
0
100000000068247901
15408156
Y
9
8
17
0
100000000068247895
15408157
Y
9
9
17
0
100000000068247888
15408158
Y
9
10
17
0
100000000068247871
15408160
Y
9
11
17
0
100000000068247864
15408161
Y
9
12
17
0
100000000068247857
15408162
Y
9
13
17
0
100000000068247833
15408163
Y
9
14
17
0
100000000068247819
15408166
Y
9
15
17
0
100000000068247796
15408167
Y
9
16
17
0
100000000068247772
15408168
Y
9
17
17
0
100000000068247789
15408171
Y
20
1
15
0
100000000068261815
15408139
Y
20
2
15
0
100000000068261822
15408141
Y
20
3
15
0
100000000068261839
15408142
Y
20
4
15
0
100000000068261846
15408143
Y
20
5
15
0
100000000068261853
15408144
Y
20
6
15
0
100000000068261860
15408145
Y
20
7
15
0
100000000068261877
15408148
Y
20
8
15
0
100000000068261884
15408155
Y
20
9
15
0
100000000068261891
15408159
Y
20
10
15
0
100000000068261907
15408164
Y
20
11
15
0
100000000068261914
15408169
Y
20
12
15
0
100000000068261921
15408172
Y
20
13
15
0
100000000068261938
15408173
Y
20
14
15
0
100000000068263154
15408175
Y
20
15
15
0
100000000068263161
15408177