Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
how to become a god in a hell look-a-like db
select
tb.table_name, count(*) as num_cons
from
user_tables tb
inner join user_constraints ct
on ct.table_name = tb.table_name
inner join user_cons_columns cc
on cc.constraint_name = ct.constraint_name
and cc.table_name = ct.table_name
where
regexp_like(tb.table_name, 'fu*k', 'i')
and ct.constraint_type = 'P'
group by
tb.table_name
order by
num_cons
/
-- why?
/*
1st cuz i can
2nd the database is a mess and uses the stupid multi-field-constraints-keys-that-some-programmers-that-suck-loves
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment