hs.hsadmin.ng/sql/29-hs-statistics.sql

29 lines
1.2 KiB
MySQL
Raw Permalink Normal View History

2022-07-22 13:31:37 +02:00
-- ========================================================
-- Some Business Table Statistics
-- --------------------------------------------------------
2022-07-29 08:46:04 +02:00
drop view if exists "BusinessTableStatisticsV";
create view "BusinessTableStatisticsV" as
select no,
to_char("count", '999 999 999') as "count",
to_char("required", '999 999 999') as "required",
to_char("count"::float / "required"::float, '990.999') as "factor",
"table"
from (select 1 as no, count(*) as "count", 7000 as "required", 'customers' as "table"
from customer
union
select 2 as no, count(*) as "count", 15000 as "required", 'packages' as "table"
from package
union
select 3 as no, count(*) as "count", 150000 as "required", 'domain' as "table"
from domain
2022-07-29 08:46:04 +02:00
union
select 4 as no, count(*) as "count", 100000 as "required", 'domain' as "table"
from domain
union
select 5 as no, count(*) as "count", 500000 as "required", 'emailaddress' as "table"
from emailaddress) totals
order by totals.no;
2022-07-29 08:46:04 +02:00
select * from "BusinessTableStatisticsV";