| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- Presto
- Java
- google apps script
- PostgreSQL
- array
- Python
- Redshift
- hive
- django
- dataframe
- Excel
- Google Excel
- matplotlib
- string
- GIT
- Github
- c#
- PANDAS
- Kotlin
- PySpark
- list
- Google Spreadsheet
- 파이썬
- Apache
- gas
- SQL
- math
- numpy
- Today
- Total
목록SQL (132)
달나라 노트
Hive에선 collect_list, collect_set이라는 함수를 제공합니다. 이는 여러 행의 데이터를 합칠 때 사용합니다. 마치 Redshift의 listagg와 비슷한 함수라고 생각하면 되겠네요. Table name = employees department_no join_dt name 10 2020-02-01 Bero 10 2020-02-02 Alice 10 2020-02-03 Alice 20 2020-02-03 Dave 20 2020-02-02 Hella 20 2020-02-04 Alice 30 2020-02-06 Grace 30 2020-02-04 Irene 30 2020-02-05 Hella 위와 같은 table이 있다고 가정해봅시다. selectdepartment_no , collect_..
position(text1 in text2) Redshift의 position 함수는 위처럼 사용할 수 있으며 text1을 text2에서 찾아 그 위치를 반환합니다. selectposition('a' in 'abcde') ; - Result 1 selectposition('b' in 'abcde') ; - Result 2 selectposition('c' in 'abcde') ; - Result 3 selectposition('d' in 'abcde') ; - Result 4 selectposition('e' in 'abcde') ; - Result 5 위 예시를 보면 이해가 쉽습니다. a, b, c, d, e라는 각각의 문자를 'abcde'라는 문자열에서 찾아 그 위치를 반환해줍니다. 가장 첫번째 위치..
LISTAGG() LISTAGG() 함수는 동일한 Column에 있는 데이터들 중 여러 Row의 데이터들을 하나의 행으로 합쳐주는 기능을 가집니다. 자세한건 실제 예시를 보시죠. Table name = employees department_no join_dt name 10 2020-02-01 Bero 10 2020-02-02 Alice 10 2020-02-03 Chris 20 2020-02-03 Dave 20 2020-02-02 Filia 20 2020-02-04 Elin 30 2020-02-06 Grace 30 2020-02-04 Irene 30 2020-02-05 Hella LISTAGG(column_name, 'seperator') WITHIN GROUP (ORDER BY column_name) O..
Redshift에선 Regular expression을 이용한 replace 기능을 제공합니다. regexp_replace(old_text, re_exp_pattern, new_text) regexp_replace의 사용법은 위와 같습니다. old_text에서 re_exp_pattern과 일치하는 부분을 찾아 new_text로 바꾸라는 뜻이죠. select regexp_replace('abc@123.com', '@.*\\.com', '') -> abc 반환 , regexp_replace('abc@email.com', '@.*\\.com', '') -> abc 반환 , regexp_replace('abc@email123.com', '@.*\\.com', '') -> abc 반환 ; 위 쿼리의 결과는 모두 ..