docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화

Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
Antigravity Agent
2026-07-05 00:10:59 +09:00
parent a397bc4720
commit 1cfd3bbb56
1495 changed files with 68534 additions and 27 deletions
@@ -0,0 +1,100 @@
---
id: sql-stored-procedures
title: "SQL Stored Procedures"
category: "Database"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["Stored Procedure", "CREATE PROCEDURE", "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", "stored-procedure"]
raw_sources: ["https://www.w3schools.com/sql/sql_stored_procedures.asp"]
applied_in: []
github_commit: ""
---
# [[SQL Stored Procedures]]
## 🎯 한 줄 통찰 (One-line insight)
A stored procedure is precompiled, reusable, parameterized SQL saved in the database — trading a bit of upfront setup for reuse, performance, security, and centralized maintenance. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Stored procedure** — precompiled SQL code that can be saved and reused; can accept parameters to vary its behavior per call. [S1]
- **Key benefits** — code reusability (callable from various applications), improved performance (precompiled), database security (permission can be scoped to the procedure rather than direct table access), easy maintenance (one update propagates to all callers). [S1]
- **Create syntax (SQL Server)** — `CREATE PROCEDURE procedure_name @param1 datatype, @param2 datatype AS BEGIN ... END;`. [S1]
- **Execute syntax** — `EXEC procedure_name @param1 = 'value1', @param2 = 'value2';`. [S1]
- **Drop syntax** — `DROP PROCEDURE procedure_name;`, or safely with `DROP PROCEDURE IF EXISTS procedure_name;`. [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Security-through-indirection** — granting users permission to execute a specific procedure (rather than direct table access) limits what they can do while still letting them accomplish their task. [S1]
- **Idempotent drop** — `IF EXISTS` on DROP PROCEDURE avoids an error if the procedure was already removed, useful in re-runnable setup/migration scripts. [S1]
## 📖 세부 내용 (Details)
- Single-parameter procedure: [S1]
```sql
CREATE PROCEDURE GetCustomersByCity
@City nvarchar(50)
AS
BEGIN
SELECT * FROM Customers
WHERE City = @City;
END;
```
Executed with: `EXEC GetCustomersByCity @City = 'London';`. [S1]
- Multi-parameter procedure: [S1]
```sql
CREATE PROCEDURE GetCustomersByCity
@City nvarchar(50),
@PostalCode nvarchar(10)
AS
BEGIN
SELECT * FROM Customers
WHERE City = @City AND PostalCode = @PostalCode;
END;
```
Executed with: `EXEC GetCustomersByCity @City = 'London', @PostalCode = 'WA1 1DP';`. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
소스에서 모순되는 정보는 발견되지 않음. 문법은 SQL Server 기준이며, MySQL은 별도 문법을 참조하라고 안내됨. [S1]
## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 반복 실행되는 조회 로직을 재사용 가능한 단위로 캡슐화할 때 쓰이는 표준 패턴이다. [S1]
## 💻 코드 패턴 (Code patterns)
Parameterized stored procedure (SQL Server):
```sql
CREATE PROCEDURE GetCustomersByCity
@City nvarchar(50)
AS
BEGIN
SELECT * FROM Customers
WHERE City = @City;
END;
```
```sql
EXEC GetCustomersByCity @City = 'London';
```
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.88
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[SQL Tutorial]]
- **관련 개념:** [[SQL Select]], [[SQL Where]], [[SQL Injection]]
- **참조 맥락:** 재사용 가능한 파라미터화 쿼리가 필요할 때 사용 — 이후 SQL Injection/Prepared Statements 챕터의 보안 논의와도 연결된다.
## 📚 출처 (Sources)
- [S1] W3Schools — SQL Stored Procedures — https://www.w3schools.com/sql/sql_stored_procedures.asp
## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "SQL Stored Procedures" page (Astra wiki-curation, P-Reinforce v3.1 format).