| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- Google Spreadsheet
- matplotlib
- Java
- Github
- string
- PANDAS
- numpy
- math
- list
- Excel
- Presto
- SQL
- 파이썬
- Redshift
- PySpark
- hive
- dataframe
- Python
- django
- google apps script
- Apache
- array
- PostgreSQL
- Google Excel
- GIT
- gas
- Tkinter
- c#
- Kotlin
- Today
- Total
목록SQL (132)
달나라 노트
Hive에서 s3 서버를 다룰 수 있는 방법을 알아봅시다. ----- Hive database -> S3 server ----- drop table if exists test_schema.test_table; create external table test_schema.test_table ( col_1 bigint, col_2 string ) row format serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde' -- row format delimited fields terminated by ',' -- lines terminated by '\n' stored as textfile location 's3://root_dir/test_dir/' ; ----- Inse..
date_add(datepart, interval_value, date/time/timestamp) date_add 함수는 위처럼 사용할 수 있습니다. datepart = 날짜 연산을 할 날짜 단위(e.g. day, week, month, year ...) interval_value = 날짜 연산을 할 시간의 양 date/time/timestamp = 기준 날짜 select current_date; --> 2021-02-22 select date_add('day', 10, current_date); --> 2021-03-04 00:00:00.000000 select date_add('week', 2, current_date); --> 2021-03-08 00:00:00.000000 select date_..
first_value, last_value는 window function으로서 이용 가능합니다. first_value([column_name]) over(partition by [column_name] order by [column_name] rows between ~~ and ~~) last_value([column_name]) over(partition by [column_name] order by [column_name] rows between ~~ and ~~) 예시를 보면 위처럼 사용할 수 있습니다. 해석을 해보면 partition by [column_name] = 이 컬럼을 parititon으로 나눠서 order by [column_name] = 이 컬럼 기준으로 정렬을 한 후 first_va..
Syntaxdate_trunc('datepart', date/timestamp)date_trunc 함수는 위처럼 사용할 수 있습니다.주어진 date를 명시한 datepart까지만 남기고 그 이하는 모두 자른 후(모두 가장 작은 값으로 만든 후) timestamp를 반환합니다. select getdate() as current_dttm --> 2025-09-18 03:23:12.907 , date_trunc('year', getdate()) as trunc_year --> 2025-01-01 00:00:00.000 , date_trunc('quarter', getdate()) as trunc_quarter --> 2025-07-01 00:00:00.000 ..