일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- PostgreSQL
- GIT
- Apache
- SQL
- google apps script
- hive
- Mac
- matplotlib
- Java
- django
- 파이썬
- string
- dataframe
- Redshift
- array
- list
- Tkinter
- Excel
- Kotlin
- Github
- PySpark
- Google Excel
- gas
- PANDAS
- Google Spreadsheet
- math
- Python
- numpy
- c#
- Today
- Total
목록Redshift (69)
달나라 노트
임시 테이블을 만드는 방법은 create temp table을 이용하면 됩니다. 근데 with 구문을 이용하여 위와 비슷한 기능을 사용할 수 있습니다. with valid_user as ( selectui.userkey from user.user_info as ui -- where 1=1 and ui.valid = 1 ), user_address as ( selecta.address_code from user.address as a -- where 1=1 and a.valid = 1 ) -- select* from order.order_list as ol -- join valid_user as vu on vu.userkey = ol.userkey join user_address as ua on ua.ad..
create table test_schema.test_table ( col1 varchar(max), col2 bigint(max), col3 varchar(max) ) ; create table은 위처럼 테이블을 생성시킬 수 있도록 합니다. 위 테이블은 col1, col2, col3라는 3개의 column을 가질 것이고, 각 컬럼에 들어갈 값들의 datatype은 순서대로 varchar(문자), bigint(정수), varchar(문자)입니다. create table if not exists test_schema.test_table ( col1 varchar(max), col2 bigint(max), col3 varchar(max) ) ; 또한 if not exists라는 옵션을 추가할 수도 있습니다...
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..