반응형
반응형

인도의 아침은 짜이 한 잔으로 시작한다
모닝 짜이를 마시지 않는 아침은 산 날이 아니다

오늘 하루 인생을 시작하기 전,
깊은 숨을 쉬며 심신을 가다듬는 생의 의례

아침 태양이 비추는
나무 아래 카페에, 일단 앉아라

짜이를 마셔라, 인사하라, 한 번 웃어라
그러면 다른 하루가 시작될 것이니


- 박노해의 시〈아침은 짜이 한 잔〉(전문)에서 -


* 아침에 마시는 차 한 잔의 기쁨.
소소하지만 놓칠 수 없는 행복입니다.
누구와 마시느냐에 따라 차 맛이 또 달라집니다.
그 차 맛과 더불어 시작되는 하루인데,
어제와 전혀 다른 하루입니다.

반응형

'아침편지' 카테고리의 다른 글

요즘 청소년의 꿈  (0) 2021.03.08
희미한 추억을 되살리려면  (0) 2021.03.08
단 하나의 행운  (0) 2021.03.04
거미줄처럼 얽힌 내 안의 '경계선'  (0) 2021.03.03
나를 드러내는데 10년이 걸렸다  (0) 2021.03.03
반응형

삼성정품/당일발송 갤럭시탭A 8.0 2019 WIFI 32G SM-T290

itempage3.auction.co.kr/DetailView.aspx?ItemNo=C275528038

 

삼성정품/당일발송 갤럭시탭A 8.0 2019 WIFI 32G SM-T290 - 옥션

11% 할인. 노트북/PC>노트북>노트북

itempage3.auction.co.kr

반응형
반응형

성공 방정식을 찾아냈다고 생각하는 순간이 기업에 가장 위험하다.
새로운 것에 도전하기보다 기존 성공에 안주하게 된다.
변화가 필요 없어 보일 때 변화를 이끌어 내는 것이 경영자의 역할이다.
- 마크 파커, 나이키 CEO


급변하는 세상에서 오래가는 성공방식이 존재할 리 없습니다.
오히려 어제의 성공방정식이 내일의 실패 방정식이 될 가능성이 농후합니다.
특히나 성공은 자연스럽게 안주(安住)를 불러옵니다.
리더의 자리는 늘 좌불안석일 수 밖에 없습니다.
없는 위기도 만들어야 하는 것이 경영자의 책무입니다.

반응형
반응형

함께여서 좋고,
혼자여서 좋은 관계가 우리였고,
그렇기에 또다시 홀로 사막으로 떠날 수
있는 용기를 얻었다. 우리를 타오르게 하는
힘은 도대체 무엇일까? 인생에서 우리에게
일어나는 단 하나의 행운, 기적적인 사랑을
만났을 때 먼지 같은 우리의 삶이 타오르는
것일지도 모른다. 별똥별처럼, 우리의 삶
역시 더 이상 이 광활한 우주에서
먼지처럼 떠돌지 않게
될는지도 모른다.


- 주형원의《사하라를 걷다》중에서 -


* 한 사람이
다른 한 사람을 만나 서로 사랑하는 것,
그것은 기적입니다. 단 하나의 행운입니다.
무(無)에서 유(有)를 창조하고, 먼지보다 작은 것도
거대한 불길처럼 활활 타오르게 만듭니다. 사랑하기
때문에, 사랑하는 사람이 있기 때문에 광막한
사막길을 홀로 걸어도 두렵거나 외롭지
않습니다. 기적과도 같은 단 하나의
행운을 믿으며 더 큰 용기를
낼 수 있습니다.

반응형

'아침편지' 카테고리의 다른 글

희미한 추억을 되살리려면  (0) 2021.03.08
아침에 차 한 잔  (0) 2021.03.05
거미줄처럼 얽힌 내 안의 '경계선'  (0) 2021.03.03
나를 드러내는데 10년이 걸렸다  (0) 2021.03.03
중심(中心)이 바로 서야  (0) 2021.03.03
반응형

PostgreSQL 날짜&시간 사용하기

www.postgresql.org/docs/8.4/functions-datetime.html

 

Date/Time Functions and Operators

Table 9-27 shows the available functions for date/time value processing, with details appearing in the following subsections. Table 9-26 illustrates the behaviors of the basic arithmetic operators (+, *, etc.). For formatting functions, refer to Section 9.

www.postgresql.org

www.postgresql.org/docs/8.4/functions-formatting.html

 

Data Type Formatting Functions

The PostgreSQL formatting functions provide a powerful set of tools for converting various data types (date/time, integer, floating point, numeric) to formatted strings and for converting from formatted strings to specific data types. Table 9-20 lists them

www.postgresql.org

해당 날짜의 데이터 

 

select count(watt_max) from tbl_test_watt3_sm2ch_min
where to_char(regdate, 'YYYY-MM-DD') = '2016-10-17'

 

소요시간 : 124초  (150만건)  (하루: 20*60*60*24 = 1,728,000)   이렇게 하면 망함!

 

해당 날짜의 데이터 

 

select count(watt) from tbl_test_watt_lsh where 

regdate >= date '2016-10-17'

and regdate < date '2016-10-17' + integer '1'   // 여기선 하루 

 

소요시간 : 634ms  (150만건)  (하루: 20*60*60*24 = 1,728,000)

 

 

해당 날짜의 데이터 

 

select count(watt) from tbl_test_watt_lsh where 

regdate >=  current_date 

and regdate < current_date + 1

 

소요시간 : 634ms  (150만건)  (하루: 20*60*60*24 = 1,728,000)

 

 

해당 시간의 데이터 

 

select count(watt) from tbl_test_watt_lsh where regdate

between  to_timestamp('2016-10-17 07:40:00' , 'YYYY-MM-DD HH24:MI:SS')  and   to_timestamp('2016-10-17 07:43:00', 'YYYY-MM-DD HH24:MI:SS')

 

소요시간 : 14ms  (3600건)  (하루: 20*60*60*24 = 1,728,000)

 

 

select count(watt) from tbl_test_watt_lsh where regdate

between  to_timestamp('2016-10-17 07:40:00' , 'YYYY-MM-DD HH24:MI:SS')  and   to_timestamp('2016-10-17 07:43:00', 'YYYY-MM-DD HH24:MI:SS') + interval '1'    // 여기선 1초 

 

소요시간 : 14ms  (3620건)

 

 

select count(watt) from tbl_test_watt_lsh where regdate

between  to_timestamp('2016-10-17 07:40:00' , 'YYYY-MM-DD HH24:MI:SS')  and   to_timestamp('2016-10-17 07:43:00', 'YYYY-MM-DD HH24:MI:SS') + interval '1' HOUR   // 여기선 1 시간  

 

소요시간 : 23ms  (63340건)

 

select count(watt) from tbl_test_watt_lsh where regdate

between  to_timestamp('2016-10-17 00:00:00' , 'YYYY-MM-DD HH24:MI:SS')  and   to_timestamp('2016-10-17 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + '1-1 00:00:00' // 여기선 하루 , 인터벌 값을 이렇게 나타낼 수 있다 

 

'10-10' 는 10년 10개월 

 

소요시간 : 433ms  (1496720건)

 

 

select * from tbl_test_watt_lsh where to_char(regdate , 'YYYY-MM-DD HH24;MI:SS') > '2016-10-17 07:40:00' AND  to_char(regdate , 'YYYY-MM-DD HH24;MI:SS') < '2016-10-17 07:43:00'

 

역시 to_char 사용하면 망함!

 

-- 오늘 (date)
select current_date;
 
-- 현재시각 (timestamp)
select now();
select current_timestamp;
 
-- 어제/오늘/내일
select
  current_date - 1 "어제",
  current_date     "오늘",
  current_date + 1 "내일"
;
 
-- day of week
select extract(dow from current_date);    -- 일요일(0) ~ 토요일(6)
select extract(isodow from current_date); -- 월요일(1) ~ 일요일(7)
 
-- day of year
select extract(doy from current_date);
 
-- week of year
select extract(week from current_date);
 
-- 두 날짜 사이의 날수
select '2010-07-05'::date - '2010-06-25'::date;
 

 

반응형
반응형

■ 마이그레이션 : SQL Server → PostgreSQL

 

 데이터 타입

 

SQL Server

PostgreSQL

BIGINT

64-bit integer

BIGINT

BINARY(n)

Fixed-length byte string

BYTEA

BIT

1, 0 or NULL

BOOLEAN

CHAR(n), CHARACTER(n)

Fixed-length character string, 1 ⇐ n ⇐ 8000

CHAR(n), CHARACTER(n)

DATE

Date (year, month and day)

DATE

DATETIME

Date and time with fraction

TIMESTAMP(3)

DATETIME2(p)

Date and time with fraction

TIMESTAMP(p)

DATETIMEOFFSET(p)

Date and time with fraction and time zone

TIMESTAMP(p) WITH TIME ZONE

DECIMAL(p,s), DEC(p,s)

Fixed-point number

DECIMAL(p,s), DEC(p,s)

DOUBLE PRECISION

Double-precision floating-point number

DOUBLE PRECISION

FLOAT(p)

Floating-point number

DOUBLE PRECISION

IMAGE

Variable-length binary data, ⇐ 2G

BYTEA

INT, INTEGER

32-bit integer

INT, INTEGER

MONEY

64-bit currency amount

MONEY

NCHAR(n)

Fixed-length Unicode UCS-2 string

CHAR(n)

NTEXT

Variable-length Unicode UCS-2 data, ⇐ 2G

TEXT

NUMERIC(p,s)

Fixed-point number

NUMERIC(p,s)

NVARCHAR(n)

Variable-length Unicode UCS-2 string

VARCHAR(n)

NVARCHAR(max)

Variable-length Unicode UCS-2 data, ⇐ 2G

TEXT

REAL

Single-precision floating-point number

REAL

ROWVERSION

Automatically updated binary data

BYTEA

SMALLDATETIME

Date and time

TIMESTAMP(0)

SMALLINT

16-bit integer

SMALLINT

SMALLMONEY

32-bit currency amount

MONEY

TEXT

Variable-length character data, ⇐ 2G

TEXT

TIME(p)

Time (hour, minute, second and fraction)

TIME(p)

TIMESTAMP

Automatically updated binary data

BYTEA

TINYINT

8-bit unsigned integer, 0 to 255

SMALLINT

UNIQUEIDENTIFIER

16-byte GUID (UUID) data

CHAR(16)

VARBINARY(n)

Variable-length byte string, 1 ⇐ n ⇐ 8000

BYTEA

VARBINARY(max)

Variable-length binary data, ⇐ 2G

BYTEA

VARCHAR(n)

Variable-length character string, 1 ⇐ n ⇐ 8000

VARCHAR(n)

VARCHAR(max)

Variable-length character data, ⇐ 2G

TEXT

XML

XML data

XML

 

 함수

 

SQL Server

PostgreSQL

DATEADD

Add an interval to datetime

INTERVAL expression

ISNULL(exp, replacement)

Replace NULL with the specified value

COALESCE(exp, replacement)

------------------------------------------------------------------------------------------------------------------------



출처: https://icodebroker.tistory.com/6429 [ICODEBROKER]

반응형

+ Recent posts