일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- GIT
- string
- dataframe
- google apps script
- Github
- Tkinter
- matplotlib
- Google Excel
- math
- 파이썬
- Kotlin
- Java
- list
- Redshift
- hive
- Excel
- array
- PySpark
- PostgreSQL
- django
- Mac
- Google Spreadsheet
- SQL
- numpy
- Apache
- PANDAS
- gas
- c#
- Today
- Total
목록SQL/Redshift (78)
달나라 노트
Redshift의 last_day 함수는 특정 날짜가 속한 달의 마지막 날짜를 return해줍니다. Syntax last_day(date or timestamp) 사용법은 간단합니다. parameter로써 날짜 type의 데이터나 timestamp type의 데이터를 받습니다. select last_day(to_date('20230216', 'yyyymmdd')) ; -- Result 2023-02-28 위 예시는 last_day 함수에 20230216이라는 날짜를 전달한 것입니다. (날짜를 전달할 땐 to_date 함수를이용해서 날짜 형식으로 바꿔줍니다.) 결과를 보면 2023년 2월의 마지막 날짜인 2023-02-28이 return됩니다. select last_day(to_date('20230908'..
Table의 생성 시점을 보기 위해선 아래 query를 실행하면 됩니다. select nspname as schema_name , relname as table_name , relcreationtime as creation_time from pg_class_info as pci -- left join pg_namespace as pns on pns.oid = pci.relnamespace -- where pci.reltype != 0 and pns.nspname = 'schema_name' and pci.relname = 'table_name' ;
select *from pg_tables; Redshift에서는 pg_table를 이용하면 database에 있는 table의 종류와 각 tabe의 owner를 알 수 있습니다. 위 쿼리의 output column은 아래 링크를 보면 됩니다.https://www.postgresql.org/docs/8.0/view-pg-tables.html pg_tablesThe view pg_tables provides access to useful information about each table in the database. Table 41-37. pg_tables Columns Name Type References Description schemaname name pg_namespace.nspname name ..
set timezone syntax를 이용하면 특정 지역에 대한 시간대를 설정할 수 있습니다.즉, 서버에 기본으로 적용되어있는 시간대를 무시하고 내가 설정한 시간대를 이용할 수 있습니다. Syntaxset timezone to 'area'set time zone 'area'area는 원하는 지역의 이름을 의미합니다.time zone 설정은 위처럼 2개의 형태로 사용할 수 있습니다.둘 중 어느 것을 사용하더라도 결과는 동일합니다.(이 글에선 첫 번째 형식을 예시로 서술합니다.) set timezone to 'Asia/Seoul';위 구문을 실행하면 Asia의 Seoul로 timezone이 설정됩니다. set timezone to 'America/New_York'위 구문은 America의 New..