---
id: sql-select-into
title: "SQL Select Into"
category: "Database"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["SQL SELECT INTO Statement", "SELECT INTO", "SQL 테이블 복사"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.88
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["sql", "database", "w3schools", "selectinto", "backup"]
raw_sources: ["https://www.w3schools.com/sql/sql_select_into.asp"]
applied_in: []
github_commit: ""
---

# [[SQL Select Into]]

## 🎯 한 줄 통찰 (One-line insight)
SELECT INTO creates a brand-new table populated from an existing one — useful for backups or ad-hoc analysis tables — but does not carry over primary keys, indexes, or NOT NULL constraints. [S1]

## 🧠 핵심 개념 (Core concepts)
- **SELECT INTO statement** — creates a new table and fills it with data from an existing table. [S1]
- **Constraint loss** — the new table gets the same column names/types as the source, but NOT primary keys, indexes, or NOT NULL constraints. [S1]
- **Syntax (full copy)** — `SELECT * INTO newtable [IN external_db] FROM sourcetable WHERE condition;`. [S1]
- **Syntax (partial copy)** — `SELECT column1, column2, ... INTO newtable [IN external_db] FROM sourcetable WHERE condition;`. [S1]

## 🧩 추출된 패턴 (Extracted patterns)
- **Empty-schema-clone trick** — `SELECT * INTO newtable FROM sourcetable WHERE 1 = 0;` creates a new, empty table with the source's schema, by using a condition that structurally can never be true. [S1]
- **Multi-table copy** — SELECT INTO can source from a JOIN across multiple tables, not just a single table. [S1]

## 📖 세부 내용 (Details)
- Full backup copy: `SELECT * INTO CustomersBackup2026 FROM Customers;`. [S1]
- Backup into another database: `SELECT * INTO CustomersBackup2026 IN 'Backup.mdb' FROM Customers;`. [S1]
- Copy specific columns only: `SELECT CustomerName, ContactName INTO Customers2 FROM Customers;`. [S1]
- Copy a filtered subset: `SELECT * INTO US_Customers FROM Customers WHERE Country = 'USA';`. [S1]
- Copy from a JOIN: `SELECT Customers.CustomerName, Orders.OrderID INTO CustomersOrder FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID;`. [S1]
- Empty schema-only clone: `SELECT * INTO newtable FROM sourcetable WHERE 1 = 0;`. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
소스에서 모순되는 정보는 발견되지 않음. 다만 새 테이블이 원본의 제약조건(PK/인덱스/NOT NULL)을 물려받지 않는다는 한계가 명시적으로 언급됨. [S1]

## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 백업 테이블 생성, 분석용 임시 테이블 생성에 전형적으로 쓰인다. [S1]

## 💻 코드 패턴 (Code patterns)
Backup copy of a table (SQL):
```sql
SELECT * INTO CustomersBackup2026
FROM Customers;
```
Schema-only empty clone (SQL):
```sql
SELECT * INTO newtable
FROM sourcetable
WHERE 1 = 0;
```

## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.88
- **중복 검사 결과:** 신규 생성 (New discovery)

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[SQL Tutorial]]
- **관련 개념:** [[SQL Insert Into Select]], [[SQL Create Table]], [[SQL Left Join]]
- **참조 맥락:** 새 테이블을 만들며 데이터를 채워야 할 때 사용 — 기존 테이블에 데이터만 옮기려면 대신 INSERT INTO SELECT를 사용.

## 📚 출처 (Sources)
- [S1] W3Schools — SQL SELECT INTO Statement — https://www.w3schools.com/sql/sql_select_into.asp

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "SQL SELECT INTO Statement" page (Astra wiki-curation, P-Reinforce v3.1 format).
