docs(10_Wiki): Dev 폴더 누락분 반영 — Topic_Programming으로 통합
이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영. - Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들 (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거. - Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/ Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/ Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이 존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존). - Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/ JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동. - 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리. - Topic_Programming 최종 문서 수: 2784 → 3985.
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
---
|
||||
id: sql-alter-table
|
||||
title: "SQL Alter Table"
|
||||
category: "Database"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["SQL ALTER TABLE Statement", "ALTER TABLE", "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", "altertable"]
|
||||
raw_sources: ["https://www.w3schools.com/sql/sql_alter.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[SQL Alter Table]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
ALTER TABLE covers six common structural operations — add/drop/rename/modify a column, add a constraint, rename the table — with syntax that fragments by vendor for renaming and modifying columns. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **ALTER TABLE statement** — adds, deletes, or modifies columns in an existing table, and adds/drops constraints. [S1]
|
||||
- **Common operations** — Add column, Drop column, Rename column, Modify column, Add constraint, Rename table. [S1]
|
||||
- **Add column** — `ALTER TABLE table_name ADD column_name datatype;`. [S1]
|
||||
- **Drop column** — `ALTER TABLE table_name DROP COLUMN column_name;` (not allowed on some database systems). [S1]
|
||||
- **Rename column** — `ALTER TABLE table_name RENAME COLUMN old_name to new_name;` (SQL Server instead uses `EXEC sp_rename`). [S1]
|
||||
- **Modify column** — `ALTER COLUMN ...` (SQL Server/MS Access) vs. `MODIFY ...` (MySQL/Oracle). [S1]
|
||||
- **Add constraint** — `ALTER TABLE table_name ADD CONSTRAINT constraint_name constraint_definition;`. [S1]
|
||||
- **Rename table** — `ALTER TABLE table_name RENAME TO new_table_name;`. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Vendor fragmentation on rename/modify** — renaming a column and modifying a column's type both require different syntax on SQL Server vs. MySQL/Oracle — the two operations most likely to trip up cross-database code. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Add a column: `ALTER TABLE Customers ADD Email varchar(255);`. [S1]
|
||||
- Modify a column with a new constraint (MySQL/Oracle): `ALTER TABLE Customers MODIFY Email varchar(100) NOT NULL;`. [S1]
|
||||
- Add a named CHECK constraint: `ALTER TABLE Members ADD CONSTRAINT CHK_Age CHECK (Age >= 18);`. [S1]
|
||||
- Rename a table: `ALTER TABLE Customers RENAME TO Clients;`. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
- **동일 의도, 다른 문법**: 컬럼 이름 변경/타입 변경이 SQL Server(`sp_rename`/`ALTER COLUMN`)와 MySQL/Oracle(`MODIFY`)에서 서로 다른 키워드를 요구함이 소스에서 명시적으로 대비됨. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
현재 발견된 실제 적용 사례가 없습니다 — 이미 생성된 테이블의 스키마를 점진적으로 진화시킬 때(마이그레이션) 쓰이는 핵심 문법이다. [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Add a column then a constraint (SQL):
|
||||
```sql
|
||||
ALTER TABLE Customers
|
||||
ADD Email varchar(255);
|
||||
|
||||
ALTER TABLE Members
|
||||
ADD CONSTRAINT CHK_Age CHECK (Age >= 18);
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.88
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[SQL Tutorial]]
|
||||
- **관련 개념:** [[SQL Create Table]], [[SQL Constraints]], [[SQL Not Null]], [[SQL Check]]
|
||||
- **참조 맥락:** 스키마 마이그레이션(컬럼/제약조건 추가·수정)의 기본 문법 — 벤더별 문법 차이를 항상 확인해야 한다.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — SQL ALTER TABLE Statement — https://www.w3schools.com/sql/sql_alter.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "SQL ALTER TABLE Statement" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user