📜  获取列数 sql 代码示例

📅  最后修改于: 2022-03-11 15:05:11.204000             🧑  作者: Mango

代码示例3
SELECT TABLE_NAME , count(COLUMN_NAME)
FROM information_schema.columns
GROUP BY TABLE_NAME;

-- Oracle (depending on schema grants):
SELECT count(*) FROM USER_TAB_COLS WHERE TABLE_NAME = 'my_table';
SELECT count(*) FROM ALL_TAB_COLS WHERE TABLE_NAME = 'my_table';
SELECT count(*) FROM DBA_TAB_COLS WHERE TABLE_NAME = 'my_table';