일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- Tkinter
- django
- list
- Python
- Excel
- 파이썬
- PANDAS
- dataframe
- array
- SQL
- Google Spreadsheet
- google apps script
- string
- c#
- Google Excel
- Redshift
- PySpark
- Apache
- gas
- Github
- Mac
- GIT
- PostgreSQL
- Java
- matplotlib
- math
- numpy
- hive
- Kotlin
- Today
- Total
목록Redshift (61)
달나라 노트
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에서 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..
Redshift에서 json_extract_path_text() 함수를 사용하면 JSON 형태로 존재하는 text를 JSON을 다루듯이 사용할 수 있습니다. Syntax json_extract_path_text(json_text, key1, key2, ...) 사용법은 위와 같습니다. 첫 번째 인자로 JSON 형태의 텍스트를 받습니다. 그리고 두번째부터는 JSON에 있는 key값을 적어주면 됩니다. select '{"apple": 20000, "banana": 8000, "peach": 22000}' as json_string , json_extract_path_text(json_string, 'apple') --> 20000 , json_extract_path_text(json_string, 'bana..
Redshift의 last_day 함수는 특정 날짜가 속한 달의 마지막 날짜를 return해줍니다. Syntax last_day(date or timestamp) 사용법은 간단합니다. parameter로써 날짜 type의 데이터나 timestamp type의 데이터를 받습니다. select last_day(to_date('20230216', 'yyyymmdd')) ; -- Result 2023-02-28 위 예시는 last_day 함수에 20230216이라는 날짜를 전달한 것입니다. (날짜를 전달할 땐 to_date 함수를이용해서 날짜 형식으로 바꿔줍니다.) 결과를 보면 2023년 2월의 마지막 날짜인 2023-02-28이 return됩니다. select last_day(to_date('20230908'..