Created
November 8, 2011 18:23
-
-
Save felclef/1348624 to your computer and use it in GitHub Desktop.
how to become a god in a hell look-a-like db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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