728x90 반응형 PostgreSQL2 [postgreSQL] 날짜/시간 함수 날짜/시간 함수 정리 -- 날짜 시간 타입으로 캐스팅 select '20190320'::date, '2019-01-02'::date select date '2019-03-18' select to_date('01022019','MMDDYYYY'), to_date('2018-12-25', 'YYYY-MM-DD') select to_timestamp('2019-01-01 20:12:12', 'YYYY-MM-DD HH:MI:SS') -- 현재시간 날짜 구하기 select now(), current_date, current_time -- 시간 더하고 빼기 select '2019-01-01'::date + interval '2 sec', '2019-01-01'::date - interval '2 sec' selec.. 2023. 4. 11. [POSTGRES] 여러개의 행 하나의 행으로 표현하기 위 사진처럼 여러개의 행을 하나의 행으로 표현하기 with school as ( select '1' as grade,'1' as class, '홍길동(1)' as name, 70 as score from dual union all select '1','1','홍길동(4)',10 from dual union all select '2','1','홍길동(5)',50 from dual union all select '2','1','홍길동(7)', 15 from dual union all select '2','2','홍길동(8)',90 from dual union all select '3','1','홍길동(2)',54 from dual union all select '3','1','홍길동(6)',60 from d.. 2023. 3. 28. 이전 1 다음 728x90 반응형