GP数据库 常用SQL语句 --1,查看列名以及类型 select upper(column_name) ,data_type from information_schema.columns where table_schema='ods_hs08' and lower(table_name)=lower('T_ods_hs08_secumreal'); --2,查看表名剔除分区表名 select a.tablename from pg_tables a where a.schemaname='…
笔者日常工作中常用到的sql语句,现总结如下,留作日后查看. 1.按照两列中的最大值取 ,只取两列其中的一列 SELECT * FROM t_doc T ORDER BY GREATEST(T.Load_Count,T.Read_Count) desc 2.取两列之和 select t.*,(nvl(T.Load_Count,0)+nvl(T.Read_Count,0 )) as c FROM t_doc T order by c desc 3.取两列字符串连接 select T.Load_Co…