SQL

Extract

Radler 2022. 4. 26. 17:44

<용도>

특정 칼럼 내에서 또 뭔가를 뽑아내서 가공하고 싶을 때, 사용.

예를 들면, 타임스태프, 나이 등

 

<문법>

EXTRACT(field FROM source)

가능 field 보려면 아래 참조로 이동.

 

<참조>

https://www.postgresql.org/docs/12/functions-datetime.html

 

9.9. Date/Time Functions and Operators

9.9. Date/Time Functions and Operators 9.9.1. EXTRACT, date_part 9.9.2. date_trunc 9.9.3. AT TIME ZONE 9.9.4. Current Date/Time 9.9.5. Delaying Execution Table 9.31 …

www.postgresql.org

 

그냥 payment_date 칼럼 조회했을 때

 

EXTRACT로 payment_date 내 에서 분기, 월 추출

 

<느낀점>

ABAP에서도 똑같은 문법으로 사용가능.

https://help.sap.com/docs/SAP_SQL_Anywhere/93079d4ba8e44920ae63ffb4def91f5b/e104835dd4484c868e23fd5aa98181ce.html?version=17.0&locale=en-US 

 

SAP Help Portal

 

help.sap.com