설문조사
PostgreSQL/PPAS 관련 듣고 싶은 교육은


총 게시물 94건, 최근 0 건
   

DATE, TIME, TIMESTAMP 데이터 타입

글쓴이 : PostgresDBA 날짜 : 2012-12-15 (토) 15:06 조회 : 18600
DATE 은 날짜 정보만 저장
TIME 은 시간 정보만 저장
TIMESTAMP 는 날짜와 시간 모두 저장합니다.

아래 예제를 보면 쉽게 이해할수 있을겁니다.

scott@[local]:5432 scottdb#SQL> create table today(x date, y time, z timestamp);
CREATE TABLE
Time: 16.428 ms

scott@[local]:5432 scottdb#SQL> insert into today(x,y,z) values(now(),now(),now());
INSERT 0 1
Time: 53.991 ms
scott@[local]:5432 scottdb#SQL> select * from today;
     x      |        y        |             z              
------------+-----------------+----------------------------
 2012-12-15 | 15:03:30.484561 | 2012-12-15 15:03:30.484561
(1 row)

Time: 0.587 ms
scott@[local]:5432 scottdb#SQL> 

   

postgresdba.com