mysql - 查询数据库的表字段

1. 

-- mysql
select column_name from information_schema.columns where table_schema='SH_ERP' and TABLE_NAME = 'stock_quant'
select * from information_schema.columns where table_schema='SH_ERP' and TABLE_NAME = 'stock_quant';

-- pg
SELECT 
array_to_string(array_agg(a.attname),',')
FROM pg_class as c,pg_attribute as a where c.relname = 'stock_quant' and a.attrelid = c.oid and a.attnum>0

 

上一篇:424. Longest Repeating Character Replacement


下一篇:05 运算符 位运算 案例