e9cbf23ab5
이전 재구성 작업에서 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.
3.6 KiB
3.6 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| sql-drop-table | SQL Drop Table | Database | draft | conceptual |
|
B | 0.9 | 2026-07-04 | 2026-07-04 |
|
|
SQL Drop Table
🎯 한 줄 통찰 (One-line insight)
DROP TABLE permanently removes a table and all its content, blocked if another table's foreign key still references it — while TRUNCATE TABLE clears all rows but keeps the table structure intact. [S1]
🧠 핵심 개념 (Core concepts)
- DROP TABLE statement — permanently deletes an existing table and all its content. [S1]
- Syntax —
DROP TABLE table_name;, or safelyDROP TABLE IF EXISTS table_name;. [S1] - Foreign key blocking — most databases refuse to drop a table still referenced by a foreign key constraint elsewhere; the constraint or dependent table must be removed first. [S1]
- TRUNCATE TABLE — deletes all records in a table while keeping the table structure, columns, and constraints. [S1]
⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
| 항목 (Option) | 장점 | 단점 | 언제 선택 |
|---|---|---|---|
| DROP TABLE | 테이블과 데이터를 완전히 제거 | 되돌릴 수 없고 구조도 사라짐, FK 참조 시 실패 | 테이블 자체가 더 이상 필요 없을 때 |
| TRUNCATE TABLE | 구조·제약조건 유지하며 데이터만 빠르게 비움 | 개별 행 조건 삭제는 불가(전체 삭제만) | 구조는 재사용하되 데이터만 초기화할 때 |
📖 세부 내용 (Details)
- Safe drop with existence check:
DROP TABLE IF EXISTS Shippers;. [S1] - Truncate (empty but keep structure):
TRUNCATE TABLE table_name;. [S1] - FK constraint blocking: dropping a table referenced by another table's FOREIGN KEY requires removing the constraint or the dependent table first. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
소스에서 모순되는 정보는 발견되지 않음.
🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — SQL Delete 챕터에서 DROP TABLE이 이미 "행 삭제(DELETE)와 다르다"는 맥락으로 먼저 언급되었고, 여기서 IF EXISTS/FK 차단/TRUNCATE로 확장된다. [S1]
💻 코드 패턴 (Code patterns)
Safe drop and truncate (SQL):
DROP TABLE IF EXISTS Shippers;
TRUNCATE TABLE table_name;
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.90
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: SQL Tutorial
- 관련 개념: SQL Delete, SQL Foreign Key, SQL Create Table
- 참조 맥락: 테이블 자체를 제거하거나 데이터만 비워야 할 때 사용 — FOREIGN KEY 참조가 걸려있는지 먼저 확인해야 한다.
📚 출처 (Sources)
- [S1] W3Schools — SQL DROP TABLE Statement — https://www.w3schools.com/sql/sql_drop_table.asp
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "SQL DROP TABLE Statement" page (Astra wiki-curation, P-Reinforce v3.1 format).