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
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
8.4
9.3
9.4
9.5
9.6
10
11
12
13
14
15
3.8
3.16
3.27
3.39
2012
2014
2016
2017
2017 (Linux)
2019
2019 (Linux)
2022
2.6
2.8
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
AdventureWorks
no sample DB
no sample DB
AdventureWorks
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 ep_pay_stubs(display_date date)
insert into ep_pay_stubs select to_date('01/01/2019','MM/DD/YYYY') from dual connect by level<=50000
50000 rows affected
with cte as ( select xmlelement("root", xmlagg( xmltype( dbms_xmlgen.getxml('select to_char(display_date, ''YYYY-MON'') as year_mon, count(*) month_count from ' || owner || '.' || table_name || ' WHERE display_date BETWEEN to_date(''01/01/2019'',''MM/DD/YYYY'') AND TO_DATE(''10/31/2019 23:59:59'',''MM/DD/YYYY HH24:MI:SS'')' || ' group by to_char(display_date, ''YYYY-MON'')' ) ) ) ) myxml from all_tables where table_name = 'EP_PAY_STUBS' ) select year_month, sum(month_count) from cte, xmltable( '/root/ROWSET/ROW' passing myxml columns year_month varchar2(8) path 'YEAR_MON', month_count number path 'MONTH_COUNT' ) group by year_month order by to_date(year_month,'YYYY-MON') /
YEAR_MONTH
SUM(MONTH_COUNT)
2019-JAN
50000