Files
turso/perf/tpc-h/queries/15.sql
2025-05-15 17:09:49 +03:00

37 lines
596 B
SQL

-- LIMBO_SKIP: views not supported
create view revenue0 (supplier_no, total_revenue) as
select
l_suppkey,
sum(l_extendedprice * (1 - l_discount))
from
lineitem
where
l_shipdate >= cast('1993-01-01' as datetime)
and l_shipdate < cast('1993-04-01' as datetime) -- modified not to include cast({'month': 3} as interval)
group by
l_suppkey;
select
s_suppkey,
s_name,
s_address,
s_phone,
total_revenue
from
supplier,
revenue0
where
s_suppkey = supplier_no
and total_revenue = (
select
max(total_revenue)
from
revenue0
)
order by
s_suppkey;
drop view revenue0;