반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- hive
- matplotlib
- PANDAS
- Kotlin
- GIT
- 파이썬
- Apache
- array
- Java
- c#
- django
- Github
- math
- PostgreSQL
- dataframe
- Mac
- list
- Tkinter
- gas
- Python
- numpy
- SQL
- string
- Excel
- Redshift
- google apps script
- Google Spreadsheet
- PySpark
- Google Excel
Archives
- Today
- Total
달나라 노트
Redshift : alter table ~ rename to ~ (table 이름 변경, table 명 바꾸기) 본문
SQL/Redshift
Redshift : alter table ~ rename to ~ (table 이름 변경, table 명 바꾸기)
CosmosProject 2022. 10. 19. 19:23728x90
반응형
alter table ~ rename to ~ 구문을 사용하면 table의 이름을 바꿀 수 있습니다.
Syntax
alter table (original_table_name) rename to (new_table_name)
(original_table_name) = 기존 테이블 이름입니다. schema와 table 이름 모두를 적어야합니다.
(new_table_name) = 새로운 테이블 이름입니다. schema 이름은 생략하고 table 이름만 적어야 합니다.
alter table test_schema.first_table
rename to second_table
;
현재 test_schema.first_table이라는 테이블이 있다고 가정해봅시다.
그리고 이 table의 이름을 test_schema.second_table로 바꾸고싶다고 가정해봅시다.
그러면 위처럼 alter table (기존 테이블 이름) rename to (새로운 테이블 이름) 형식으로 alter table 구문을 적어주면 됩니다.
한 가지 주의할 점은 기존 테이블 이름은 test_schema.first_table 처럼 schema와 table 이름을 다 적어줘야 하지만
rename to 뒤에 적어야 할 새로운 테이블 이름은 second_table 처럼 schema 이름은 생략하고 변경할 새로운 테이블의 이름만 적어줘야 합니다.
위 구문을 실행하면 test_schema.first_table 의 이름이 test_schema.second_table로 바뀌게 됩니다.
728x90
반응형
'SQL > Redshift' 카테고리의 다른 글
Comments