SocioCryptoBlock time
    Updated 2023-04-22
    SELECT 'NEAR' as label,
    'L1' as sub_label,
    avg(datediff(second, a.block_timestamp,b.block_timestamp)) as avg_time_diff
    FROM near.core.fact_blocks a, near.core.fact_blocks b
    WHERE a.block_id = b.block_id -1
    AND date_trunc('day',a.block_timestamp) between CURRENT_DATE-30 and CURRENT_DATE-1
    UNION
    SELECT 'Polygon' as label,
    'L1' as sub_label,
    avg(datediff(second, a.block_timestamp,b.block_timestamp)) as avg_time_diff
    FROM polygon.core.fact_blocks a, polygon.core.fact_blocks b
    WHERE a.block_number = b.block_number -1
    AND date_trunc('day',a.block_timestamp) between CURRENT_DATE-30 and CURRENT_DATE-1
    UNION
    SELECT 'Ethereum' as label,
    'L1' as sub_label,
    avg(datediff(second, a.block_timestamp,b.block_timestamp)) as avg_time_diff
    FROM ethereum.core.fact_blocks a, ethereum.core.fact_blocks b
    WHERE a.block_number = b.block_number -1
    AND date_trunc('day',a.block_timestamp) between CURRENT_DATE-30 and CURRENT_DATE-1
    UNION
    SELECT 'Solana' as label,
    'L1' as sub_label,
    avg(datediff(second, a.block_timestamp,b.block_timestamp)) as avg_time_diff
    FROM solana.core.fact_blocks a, solana.core.fact_blocks b
    WHERE a.block_id = b.block_id -1
    AND date_trunc('day',a.block_timestamp) between CURRENT_DATE-30 and CURRENT_DATE-1
    UNION
    SELECT 'Terra' as label,
    'Terra' as sub_label,
    avg(datediff(second, a.block_timestamp,b.block_timestamp)) as avg_time_diff
    FROM terra.core.fact_blocks a, terra.core.fact_blocks b
    WHERE a.block_id = b.block_id -1
    AND date_trunc('day',a.block_timestamp) between CURRENT_DATE-30 and CURRENT_DATE-1
    UNION
    SELECT 'Avalanche' as label,
    Run a query to Download Data