how to count number of tables/views/index in my da

2019-07-16 04:44发布

问题:

how to count number of tables/views/index in my database

I am using sybase 11

回答1:

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.



回答2:

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;



回答3:

Hi Hope this below sql works

SELECT COUNT(*) FROM USER_TABLES;

will return you number of tables in respective database.



标签: sybase