In Oracle, you can use the select statement with "count(*)" to query how many columns there are in the table. The syntax is "select count(*) from user_tab_cols where table_name='table name'"; "user_tab_cols" It can also be used to query hidden columns, and the English in the table name should use uppercase letters.
The operating environment of this tutorial: Windows 10 system, Oracle version 12c, Dell G3 computer.
How many columns to query in oracle:
select count(*) from user_tab_cols where table_name='表名';
--If the table name contains English, it should be English capital letters
Examples are as follows:
Extended knowledge:
The difference between user_tab_cols and user_tab_columns in Oracle
Both tables can be used to query Table, View and Clusters under the user
Difference
-- 通过执行此SQL语句,可发现user_tab_cols还包含隐藏列,因此平时使用时推荐使用user_tab_columns select column_name from user_tab_cols where table_name = 'TEST' minus select column_name from user_tab_columns where table_name = 'TEST';
By comparing with user_tab_comments (table comments), user_col_comments ( Field comments) can basically meet general statistical needs.
How many columns can be queried by mysql:
select count(*) from information_schema.COLUMNS where table_name='表名';
--The table name can be both uppercase and lowercase
How many columns can be queried by sqlserver:
select count(*) from syscolumns s where s.id = object_id('test');
--Table names can be uppercase or lowercase
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of How to query how many columns in oracle. For more information, please follow other related articles on the PHP Chinese website!