Oracle和MySql数据库区别之__查询数据库中某张用户表的列数
查询Oracle数据库中某张用户表的列数(需要查询的表名必须大写)
select count(*) from user_tab_columns t where t.table_name = '表名'
- 大写表名查询成功
- 小写表名查询失败
- ORA-00942错误(informatin_schema.COLUMNS表不存在)
查询Mysql数据库中某张用户表的列数
select count(*) from informatin_schema.COLUMNS where table_schema = '数据库名' and table_name= '表名'
- sql错误: user_tab_columns表不存在
- 已经指定对应的数据库下查询,sql就不需要指定 table_schema = ‘数据库名’
如果要查询具体的列信息,select count(*) from 换成select * from
即可,Oracle和MySql数据库都支持