| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- Github
- matplotlib
- Google Excel
- numpy
- PostgreSQL
- dataframe
- math
- Excel
- Apache
- c#
- 파이썬
- Kotlin
- PANDAS
- django
- Python
- google apps script
- SQL
- list
- Java
- Redshift
- Google Spreadsheet
- string
- array
- GIT
- PySpark
- gas
- hive
- Presto
- Today
- Total
목록SQL (132)
달나라 노트
Hive에서 concat() 함수는 여러 문자열을 하나로 이어주는 역할을 합니다. Syntax concat(str1, str2, str3, ...) concat() 함수는 여러 개의 parameter를 받을 수 있습니다. 그리고 string type parameter를 모두 연결해서 str1str2str3... 의 string을 return합니다. select concat('abcde, '_', '@', 'xyz', '123', '%') ; -- Result abcde_@xyz% 위처럼 모든 문자열을 연결해줍니다. select concat('_', cast(123 as string), 'abc') ; -- Result _123abc concat() 함수에 들어가는 모든 parameter는 string t..
Presto의 date_add() 함수는 어떤 시점에 특정 시간 간격(년, 월, 일, 분기, 주, 시간, 분, 초, 밀리초)을 더하고 빼는 역할을 해줍니다. Syntax date_add(unit, value, timestamp) - unit 더할 시간 간격의 단위를 의미합니다. year -> 년 month -> 월 day -> 일 quarter -> 분기 week -> 주차 dayofweek -> 요일 hour -> 시 minute -> 분 second -> 초 millisecond -> 밀리초 - value 더할 시간 간격을 의미합니다. 더하고싶으면 양수를 쓰면 되고, 빼고 싶으면 음수를 적으면 됩니다. - timestamp value를 더할 대상이 되는 timestamp입니다. timestamp 뿐 ..
두 시점간의 차이가 어느 정도인지를 구하는 방법은 여러 가지가 있겠지만 오늘은 unix_timestamp를 이용해 보겠습니다. unix_timestamp 함수는 어떤 timestamp 또는 timestamp_string을 unix_timestamp로 변환해주는 역할을 합니다. https://cosmosproject.tistory.com/50 Hive : unix_timestamp & from_unixtime (yyyymmdd 형태의 텍스트를 date type으로 바꾸기. 날짜와 unix_timestamp간의 unix_timestamp()의 사용법은 아래와 같습니다. unix_timestamp(날짜를 나타내는 텍스트, 날짜의 형식) 예시를 한번 봐봅시다. select unix_timestamp('2020-..
Syntax datediff(timestamp_1, timestamp_2) (timestamp_1 - timestamp_2) 를 계산하여 일(day) 단위로 return합니다. select current_timestamp , date_add(current_timestamp, 30) , datediff(date_add(current_timestamp, 30), current_timestamp) ; -- Result 2023-10-10 12:31:20.122000000 2023-11-09 30 date_add는 어떤 시점에 특정 일수를 더해줍니다. - datediff(date_add(current_timestamp, 30), current_timestamp) 따라서 위 구문은 아래와 동일합니다. datedi..