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.
4.5 KiB
4.5 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-auto-increment | SQL Auto Increment | Database | draft | conceptual |
|
B | 0.87 | 2026-07-04 | 2026-07-04 |
|
|
SQL Auto Increment
🎯 한 줄 통찰 (One-line insight)
Every vendor auto-generates unique primary key numbers, but under a different keyword and mechanism — MySQL's AUTO_INCREMENT, SQL Server's IDENTITY, Access's AUTOINCREMENT, and Oracle's standalone SEQUENCE object requiring an explicit nextval() call. [S1]
🧠 핵심 개념 (Core concepts)
- Auto-increment field — a numeric column that automatically generates a unique number when a new record is inserted; typically the PRIMARY KEY. [S1]
- MySQL —
AUTO_INCREMENTkeyword; default start 1, increments by 1; restart value viaALTER TABLE ... AUTO_INCREMENT = 100;. [S1] - SQL Server —
IDENTITY(seed, increment), e.g.IDENTITY(1,1). [S1] - MS Access —
AUTOINCREMENTkeyword, optionallyAUTOINCREMENT(seed, increment). [S1] - Oracle — no inline keyword; requires a standalone
SEQUENCEobject and explicitsequence.nextvalon insert. [S1]
🧩 추출된 패턴 (Extracted patterns)
- Insert without specifying the key — in MySQL/SQL Server/Access, an INSERT simply omits the auto-increment column and the value is generated automatically. [S1]
- Oracle is the odd one out — Oracle requires you to explicitly reference
seq_person.nextvalin the INSERT statement itself, rather than the column being silently populated. [S1]
⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
| 항목 (Option) | 장점 | 단점 | 언제 선택 |
|---|---|---|---|
| MySQL AUTO_INCREMENT / SQL Server IDENTITY / Access AUTOINCREMENT | 컬럼 정의만으로 자동 생성, INSERT가 간단 | 벤더 종속 문법 | 해당 벤더 사용 시 기본 선택 |
| Oracle SEQUENCE | 여러 테이블이 공유 가능, 세밀한 제어(cache, start, increment) | INSERT마다 .nextval 명시 필요, 별도 객체 관리 |
Oracle 사용 시 유일한 방법 |
📖 세부 내용 (Details)
- MySQL:
CREATE TABLE Persons (Personid int AUTO_INCREMENT PRIMARY KEY, ...);. [S1] - SQL Server:
CREATE TABLE Persons (Personid int IDENTITY(1,1) PRIMARY KEY, ...);. [S1] - Oracle:
CREATE SEQUENCE seq_person MINVALUE 1 START WITH 1 INCREMENT BY 1 CACHE 10;thenINSERT INTO Persons (Personid, FirstName, LastName) VALUES (seq_person.nextval, 'Lars', 'Monsen');. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
- 벤더 4개 모두 문법이 다름: 동일한 "자동 증가" 요구가 AUTO_INCREMENT/IDENTITY/AUTOINCREMENT/SEQUENCE로 완전히 다르게 구현됨. [S1]
🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — PRIMARY KEY 컬럼에 값을 수동 지정하지 않고 자동 생성하고 싶을 때 표준적으로 쓰이는 패턴이다. [S1]
💻 코드 패턴 (Code patterns)
MySQL and Oracle equivalents (SQL):
-- MySQL
CREATE TABLE Persons (
Personid int AUTO_INCREMENT PRIMARY KEY,
LastName varchar(255) NOT NULL
);
-- Oracle
CREATE SEQUENCE seq_person MINVALUE 1 START WITH 1 INCREMENT BY 1 CACHE 10;
INSERT INTO Persons (Personid, FirstName, LastName)
VALUES (seq_person.nextval, 'Lars', 'Monsen');
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.87
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: SQL Tutorial
- 관련 개념: SQL Primary Key, SQL Insert Into, SQL Create Table
- 참조 맥락: PRIMARY KEY 값을 자동 생성해야 할 때 사용 — 벤더별 문법 차이가 크므로 사용 중인 DB를 먼저 확인해야 한다.
📚 출처 (Sources)
- [S1] W3Schools — SQL AUTO INCREMENT Field — https://www.w3schools.com/sql/sql_autoincrement.asp
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "SQL AUTO INCREMENT Field" page (Astra wiki-curation, P-Reinforce v3.1 format).