일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Python
- hive
- Mac
- gas
- Google Spreadsheet
- 파이썬
- Github
- Kotlin
- google apps script
- PySpark
- Google Excel
- Apache
- Java
- array
- dataframe
- PANDAS
- Excel
- GIT
- c#
- math
- matplotlib
- SQL
- numpy
- list
- Redshift
- Tkinter
- string
- django
- PostgreSQL
- Today
- Total
목록SQL/Redshift (78)
달나라 노트
어떤 문자열 안에 있는 내부 문자열을 추출하고싶다면 substring 함수를 사용할 수 있습니다. Syntax substring(text, position1, position2) Syntax는 위와 같습니다. text에서 position1(숫자)에 적힌 위치로부터 position2(숫자) 만큼의 길이의 텍스트를 추출합니다. select substring('CONGRATULATIONS', 1, 1); --> 1. C select substring('CONGRATULATIONS', 1, 2); --> 2. CO select substring('CONGRATULATIONS', 2, 1); --> 3. O select substring('CONGRATULATIONS', 2, 3); --> 4. ONG selec..
Redshift에서 현재 날짜 또는 현재 시간을 추출할 수 있는 방법을 알아봅시다. select current_date; -- Result 2021-08-25 먼저 current_date입니다. current_date는 현재 날짜를 반환해줍니다. select to_char(current_date, 'yyyymmdd'); -- Result 20210825 current_date로 반환되는 날짜의 data type은 날짜이기때문에 to_char 함수와 같이 사용할 수 있습니다. select sysdate, --> 2021-08-25 19:38:52.382610 getdate() --> 2021-08-25 19:38:52.000000 ; sysdate와 getdate 함수는 현재 날짜와 시간을 반환해줍니다. ..
Redshift -> S3 -- Redshift -> S3 unload (' ----- (S3 server에 올릴 data를 추출하는 query) select item_id , item_name , price from test_table -- where valid in (''valid'') ----- (쿼리가 따옴표로 감싸져있기때문에 따옴표 2개로 string을 감싸야함.) ') to 's3://items/price_info/' ----- (unload 속에 적힌 query 결과가 저장될 s3 server의 경로) iam_role 'credential' ----- (s3 server에 로그인하기 위한 credential) manifest ----- (manifest format으로 저장) delimite..
SQL에서 어떤 패턴의 텍스트를 찾아낼 때 흔히 사용하는 operator로는 like와 ilike가 있습니다. Syntax some_text like 'pattern' some_text ilike 'pattern' Syntax는 위와 같습니다. some_text 속에 pattern과 일치하는 부분이 있다면 True를 반환하고, pattern과 일치하는 부분이 없다면 False를 반환합니다. some_text는 column 이름으로 대체 가능합니다. like와 ilike는 동일한 기능을 가지지만 차이점은 다음과 같습니다. like = 대소문자 구분(case sensitive) (e.g. a와 A는 다르다고 판단) ilike = 대소문자 구분 안함(case insensitive) (e.g. a와 A는 동일하..