일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- array
- string
- Github
- Redshift
- SQL
- Google Spreadsheet
- hive
- Kotlin
- numpy
- Java
- Apache
- matplotlib
- dataframe
- PySpark
- gas
- c#
- Google Excel
- list
- google apps script
- math
- PANDAS
- Excel
- GIT
- Python
- 파이썬
- PostgreSQL
- django
- Tkinter
- Mac
- Today
- Total
목록PostgreSQL (17)
달나라 노트
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' ;
alter table 구문을 이용해서 table에 존재하는 column을 삭제할 수 있습니다. Syntax alter table (table_name) drop column (column_name) (table_name) = 변경 사항을 적용할 table 이름입니다. (column_name) = 삭제할 column의 이름입니다. create table test_schema.test_table ( col1 bigint, col2 varchar(60), col3 date, col4 timestamp ) ; 테스트를 위해 위처럼 test_schema.test_table을 생성합시다. column은 col1, col2, col3, col4 총 4개가 존재합니다. alter table test_schema.tes..
alter table 구문을 이용해서 table에 새로운 컬럼을 추가해봅시다. Syntax alter table (table_name) add (column_name) (data_type) (table_name) = 변경 사항을 적용할 table 이름입니다. (column_name) = 새롭게 추가할 column의 이름입니다. (data_type) = 새롭게 추가할 column의 data type입니다. create table test_schema.test_table ( col1 bigint, col2 varchar(60), col3 date, col4 timestamp ) ; 테스트를 위해 위처럼 test_schema.test_table을 생성합시다. column은 col1, col2, col3, co..
alter table 구문을 이용하면 table에 존재하는 column의 이름을 바꿀 수 있습니다. Syntax alter table (table_name) rename column (original_column_name) to (new_column_name) (table_name) = 변경 내용을 적용할 table 이름 (original_column_name) = 이름을 변경할 기존의 column 이름 (new_column_name) = 변경할 새로운 column 이름 alter table test_schema.test_table rename column col3 to dt_col; 위 예시에 있는 alter table 구문을 실행하면 test_schema.test_table에 있는 col3 컬럼 이름..