首页 > 解决方案 > How to count the column in hive

问题描述

I need the count of columns in hive ,So below is the example.

Table_name:emp

columns: empno, ename, manager, dept_id

Expected output: 4

标签: hivehiveqlimpala

解决方案


Hive (now) supports the information_schema tables, so you could do:

select count(*)
from information_schema.columns
where table_name = 'emp'

推荐阅读