step2

Published: (December 3, 2025 at 03:45 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

Example Query

-- Test just ONE table to see if anything works
-- Replace 'YOUR_TABLE' with an actual table name from your 45 columns

SELECT 
  'Test on: ' || table_name as test,
  (SELECT COUNT(*) FROM user_tables WHERE table_name = 'YOUR_TABLE') as stats_count,
  (SELECT COUNT(*) FROM "YOUR_TABLE") as actual_count,
  (SELECT COUNT(*) FROM "YOUR_TABLE" WHERE INTERNTIMESTAMP >= SYSDATE - 45) as recent_count,
  (SELECT MIN(INTERNTIMESTAMP) FROM "YOUR_TABLE") as oldest,
  (SELECT MAX(INTERNTIMESTAMP) FROM "YOUR_TABLE") as newest
FROM DUAL;
Back to Blog

Related posts

Read more »

compare3

sql SELECT 'ONLY_IN_US_1' AS location, t1.table_name FROM dba_tables t1 LEFT JOIN dba_tables t2 ON t1.table_name = t2.table_name AND t2.owner = 'GL...

compare2

sql SELECT CASE WHEN t1.table_name IS NOT NULL AND t2.table_name IS NULL THEN 'ONLY_IN_US_1' WHEN t2.table_name IS NOT NULL AND...

create10

sql SELECT utc.table_name, xt.rows_last_45_days FROM SELECT table_name FROM user_tab_columns WHERE UPPERcolumn_name = 'INTERNTIMESTAMP' AND data_type LIKE 'TIME...

compare5

SQL Script sql -- Declare variables for schema UIDs run once DECLARE @uid1 int, @uid2 int SELECT @uid1 = uid FROM sysusers WHERE name = 'GLOBAL_COMET_US_1' SEL...