반응형 etc DB3 [postgres] table, column info 스키마 정보 조회 select a.relname , b.description , b.description , d.attname , c.description --, e.data_type , e.udt_name , case when e.data_type = 'character varying' then text(e.character_maximum_length) when e.data_type = 'numeric' then text(e.numeric_precision) || ',' || text(e.numeric_scale) when e.data_type = 'bigint' then '8' --text(e.numeric_precision) when e.data_type = 'integer' then '4' --t.. 2021. 10. 5. [postgres] 유용한 쿼리 select coalesce(null, 'null입니다.')--null 처리 --형 변화 select CAST ('100' AS INTEGER) , '2010-07-05'::date --날짜 select to_char(to_date('2021-08-07','YYYY-MM-DD'), 'MM/DD') --08/07 , to_char(current_date , 'MM/DD')--09/30 , to_char(current_date , 'YYYY-MM-DD')--2021-09-30 , to_char(current_date , 'YYYY-MM-DD HH24:MI:SS.MS')--2021-09-30 00:00:00.000 , TO_TIMESTAMP('2021-02-01','YYYY-MM-DD')--2021-02-01.. 2021. 9. 30. [InfoMix] IBM Informix 자주 쓰는 조회 쿼리 함수 자주쓰는 조회 쿼리 함수. --InfoMix 자주 쓰는 조회 함수 SELECT DECODE(evaluation, 'Poor', 0, 'Fair', 25, 'Good', 50, -1) as grade --case when then else , NVL(address, "address is unknown") AS address --NULL 처리 , REPLACE('Mighxzy xzime', 'xz', 't')--Mighty time , SUBSTR('ABCDEFG', -3)--EFG FROM students; 2017. 7. 5. 이전 1 다음 반응형