解析如何查看Oracle数据库中某张表的字段个数建
导读:1建站知识本篇文章是对查看Oracle数据库中某张表的字段个数进行了详细的分析介绍,需要的朋友参考下网站seo优化课程网站建设。
Oracle中查询某个表的总字段数,要用SQL语句,或者在PL/SQL里面
复制代码 代码如下:
select count(column_name) from user_tab_columns where table_name='T_B_AUDITOR'
能够查出来指定的那张表的字段数。下面是通过大致查看:select tname,count(*) from col group by tname;复制代码 代码如下:
64 T_A_BOOKSTAGEINFO 465 T_B_AUDITOR 1466 T_B_BOOKMANAGEMENT 1367 T_B_BOOKSTATUSCONFIG 568 T_B_CODETREEINF网站seo优化O 869 T_B_FILTERWORD 1170 T_B_ISBNWHITELIST 1171 T_B_MODEL 1072 T_B_NOTICE 1573 T_B_NOTICEACCEPT 1174 T_B_OPERLOG 1075 T_B_ORGANIZATIONINFO 1876 T_B_PREFIXINFO 1577 T_B_PUBLISHINFO 3078 T_B_ROLE 879 T_B_ROLEMODEL 680 T_B_SAMPLEBOOKINFO 8981 T_B_USER 2682 T_B_USERANDROLE 683 T_B_USERLOGIN 884 T_B_USERMODEL 6
此时我就联想到了mysql上面去: 直接利用函数来解决:复制代码 代码如下:
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)
还有就是利用系统表:复制代码 代码如下:
mysql> use information_schemaDatabase changedmysql> select count(*) from columns where table_name="test";+----------+| count(*) |+----------+| 3 |+----------+1 row in set (0.00 sec)
在mysql中想要知道数据库中有多少个库:复制代码 代码如下:
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)
在mysql数据库中有多少张表:复制代码 代码如下:
mysql> select table_schema,count(*) from tables group by table_schema;+--------------------+----------+| table_schema | count(*) |+--------------------+----------+| information_schema | 17 || mysql | 17 || test | 6 |+--------------------+----------+3 rows in set (0.00 sec)
声明: 本文由我的SEOUC技术文章主页发布于:2023-05-22 ,文章解析如何查看Oracle数据库中某张表的字段个数建主要讲述字段,数据库中,解析如何查看Oracle数据库中某张表网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_5057.html