

 Amazon Redshift는 패치 198부터 새 Python UDF 생성을 더 이상 지원하지 않습니다. 기존 Python UDF는 2026년 6월 30일까지 계속 작동합니다. 자세한 내용은 [블로그 게시물](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)을 참조하세요.

# SELECT INTO
<a name="r_SELECT_INTO"></a>

임의의 쿼리에 의해 정의된 행을 선택하여 새 테이블에 삽입합니다. 임시 테이블을 만들지 영구 테이블을 만들지 여부를 지정할 수 있습니다.

## 구문
<a name="r_SELECT_INTO-synopsis"></a>

```
[ WITH with_subquery [, ...] ]
SELECT
[ TOP number | [ ALL | DISTINCT ]
* | expression [ AS output_name ] [, ...] ]
[ EXCLUDE column_list ]
INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table
[ FROM table_reference [, ...] ]
[ WHERE condition ]
[ [ START WITH expression ] CONNECT BY expression ]
[ GROUP BY ALL | expression [, ...] ]
[ HAVING condition ]
[ QUALIFY condition ]
[ { UNION | ALL | INTERSECT | EXCEPT | MINUS } query ]
[ ORDER BY expression [ ASC | DESC ] ]
[ LIMIT { number | ALL } ]
[ OFFSET start ]
```

 이 명령의 파라미터에 대한 자세한 내용은 [SELECT](r_SELECT_synopsis.md) 섹션을 참조하세요.

## 예제
<a name="r_SELECT_INTO-examples"></a>

EVENT 테이블에서 모든 행을 선택하고 NEWEVENT 테이블을 만듭니다.

```
select * into newevent from event;
```

PROFITS라는 임시 테이블에 대한 집계 쿼리의 결과를 선택합니다.

```
select username, lastname, sum(pricepaid-commission) as profit
into temp table profits
from sales, users
where sales.sellerid=users.userid
group by 1, 2
order by 3 desc;
```