The total number of fields queried for a table in Oracle, using SQL statements, or in Pl/sql
Copy Code code as follows:
Select COUNT (column_name) from user_tab_columns where table_name= ' T_b_auditor '
The number of fields that can be found to specify the table.
Here's a rough view:
Select Tname,count (*) from Col Group by Tname;
Copy Code code as follows:
T_a_bookstageinfo 4
T_b_auditor 14
T_b_bookmanagement 13
T_b_bookstatusconfig 5
T_b_codetreeinfo 8
T_b_filterword 11
T_b_isbnwhitelist 11
T_b_model 10
15 T_b_notice
T_b_noticeaccept 11
T_b_operlog 10
T_b_organizationinfo 18
T_b_prefixinfo 15
T_b_publishinfo 30
T_b_role 8
6 T_b_rolemodel
89 T_b_samplebookinfo
Bayi T_b_user 26
T_b_userandrole 6
8 T_b_userlogin
6 T_b_usermodel
At this point I think of MySQL above:
use functions directly to solve:
Copy Code code as follows:
mysql> desc test;
+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| ID | Int (11) | NO | PRI | NULL | auto_increment |
| name | varchar (10) | YES | | NULL | |
| Address | varchar (30) | YES | | NULL | |
+---------+-------------+------+-----+---------+----------------+
3 rows in Set (0.01 sec)
Mysql> select Found_rows ();
+--------------+
| Found_rows () |
+--------------+
| 3 |
+--------------+
1 row in Set (0.01 sec)
There is also the use of system tables:
Copy Code code as follows:
Mysql> Use Information_schema
Database changed
Mysql> Select COUNT (*) from columns where table_name= "test";
+----------+
| COUNT (*) |
+----------+
| 3 |
+----------+
1 row in Set (0.00 sec)
in MySQL, want to know how many libraries are in the database:
Copy Code code as follows:
Mysql> select * from schemata;
+--------------+--------------------+----------------------------+------------------------+----------+
| Catalog_name | schema_name | Default_character_set_name | Default_collation_name | Sql_path |
+--------------+--------------------+----------------------------+------------------------+----------+
| NULL | Information_schema | UTF8 | Utf8_general_ci | NULL |
| NULL | MySQL | UTF8 | Utf8_general_ci | NULL |
| NULL | Test | UTF8 | Utf8_general_ci | NULL |
+--------------+--------------------+----------------------------+------------------------+----------+
3 Rows in Set (0.00 sec)
How many tables are there in the MySQL database:
Copy Code code as follows:
Mysql> Select Table_schema,count (*) from the tables group by Table_schema;
+--------------------+----------+
| Table_schema | COUNT (*) |
+--------------------+----------+
| Information_schema | 17 |
| MySQL | 17 |
| Test | 6 |
+--------------------+----------+
3 Rows in Set (0.00 sec)
In fact, in the system table Information_schema most of the database, the table AH will have records. So we should study this form well.