Reputation: 13257
how to count number of tables/views/index in my database
I am using sybase 11
Upvotes: 5
Views: 18484
Reputation: 1
SELECT COUNT(*) FROM USER_TABLES;
will return you number of tables in respective database.
Upvotes: -1
Reputation: 8461
For oracle
Count Tables:
SELECT COUNT(*) FROM user_tables;
Count Sequences
SELECT COUNT(*) FROM user_sequences;
Count Views
SELECT COUNT(*) FROM user_views;
Count Indexes
SELECT COUNT(*) FROM user_indexes;
Upvotes: 0
Reputation: 763
select count(*) from sysobjects where type = 'U'
should get you the number of user tables. You can also use type = 'V'
to count views.
select count(*) from sysindexes
will give you an index count. You may need to further filter both though, depending on which types of indexes you want.
sysobjects reference here.
sysindexes reference here.
Upvotes: 12