일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- array
- c#
- Google Spreadsheet
- Kotlin
- PySpark
- Mac
- hive
- string
- list
- Python
- dataframe
- Apache
- SQL
- math
- GIT
- Tkinter
- Google Excel
- matplotlib
- numpy
- Java
- Excel
- 파이썬
- google apps script
- Github
- PostgreSQL
- PANDAS
- django
- gas
- Redshift
- Today
- Total
목록SQL (71)
달나라 노트
Presto의 date_diff() 함수는 두 시점간의 차이를 원하는 단위(e.g. 시간, 분 등)로 return합니다. Syntax date_diff(unit, start_datetime, end_datetime) - unit 두 시점간의 차이를 어떤 단위로 return할지를 결정합니다. year = 두 시점간의 차이를 년 단위로 계산합니다. month = 두 시점간의 차이를 월 단위로 계산합니다. day = 두 시점간의 차이를 일 단위로 계산합니다. hour = 두 시점간의 차이를 시간 단위로 계산합니다. minute = 두 시점간의 차이를 분 단위로 계산합니다. second = 두 시점간의 차이를 초 단위로 계산합니다. - start_datetime 시작 시점의 datetime입니다. - end_d..
to_timestamp() 함수는 날짜/시간 형태의 문자열이나 timestamp type의 데이터를 받아 원하는 timestampz로 변환합니다. Syntax to_timestamp(timestamp/timestamp_string, format) - timestamp/timestamp_string timestamp로 type을 변환할 대상 timestamp 또는 날짜/시간 형태의 문자열을 전달합니다. - format timestamp/timestamp_string 이 어떤 형태를 가지고 있는지에 대한 pattern을 의미합니다. select to_timestamp('20230101_082739', 'yyyymmdd_HH24MISS') -- Result 2023-01-01 08:27:39.000000 +0..

Redshift의 next_day() 함수는 어떤 timestamp로부터 가장 가까운 미래의 어떤 요일의 날짜를 return해줍니다. Syntax next_day(timestamp, weekday) - timestamp 기준이 되는 날짜시점입니다. - weekday 가장 가까운 미래의 어떤 요일을 의미합니다. 예시로 보는게 더 이해가 빠를겁니다. select current_date --> 2023-09-20 , next_day(current_date, 'mon') as next_mon --> 2023-09-25 , next_day(current_date, 'tue') as next_tue --> 2023-09-26 , next_day(current_date, 'wed') as next_wed --> 20..
Redshift에서 json_extract_array_element_text() 함수는 indexing을 통해 array에서 값을 추출해줍니다. Syntax json_extract_array_element_text(json_array_text, index) 사용법은 위와 같습니다. json_array_text -> JSON array 형태로 된 text를 받습니다. index -> 추출할 index의 번호를 의미합니다. select '["apple", "banana", "pineapple", "peach"]' as json_arr_text , json_extract_array_element_text(json_arr_text, 0) as col0 , json_extract_array_element_text..