Files
2nd/10_Wiki/Dev/Topic_PHP/PHP_MySQL_Create_Table.md
T
Antigravity Agent 1cfd3bbb56 docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
2026-07-05 00:10:59 +09:00

3.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
php-mysql-create-table PHP MySQL Create Table Programming_Language draft conceptual
CREATE TABLE
AUTO_INCREMENT
PHP MySQL 테이블 생성
B 0.89 2026-07-04 2026-07-04
php
programming
w3schools
mysql
create-table
https://www.w3schools.com/php/php_mysql_create_table.asp

PHP MySQL Create Table

🎯 한 줄 통찰 (One-line insight)

The reg_date column's default value (DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) does double duty — it auto-fills on INSERT and auto-refreshes on every UPDATE, meaning a single column definition handles both "record creation time" and "last modified time" without any PHP-side logic. [S1]

🧠 핵심 개념 (Core concepts)

  • CREATE TABLE — the SQL command; this chapter creates "MyGuests" with 5 columns. [S1]
  • Column attributesUNSIGNED (positive numbers + zero only), AUTO_INCREMENT (auto-increases by 1 per new record), PRIMARY KEY (uniquely identifies rows, often paired with AUTO_INCREMENT), NOT NULL (value required), DEFAULT value (fallback when none is provided). [S1]
  • Every table needs a primary key — a unique-per-record identifier column. [S1]
  • Requires create privileges — a separate permission from admin privileges (used for CREATE DATABASE). [S1]

📖 세부 내용 (Details)

  • Full table definition: CREATE TABLE MyGuests ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, email VARCHAR(50), reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ). [S1]
  • Executed via MySQLi OOP: $conn->query($sql); procedural: mysqli_query($conn, $sql); PDO: $conn->exec($sql) inside try/catch. [S1]

⚖️ 모순 및 업데이트 (Contradictions & updates)

소스에서 모순되는 정보는 발견되지 않음.

🛠️ 적용 사례 (Applied in summary)

현재 발견된 실제 적용 사례가 없습니다 — reg_date 컬럼이 생성 시각과 수정 시각을 동시에 자동 관리하는 것이 실전 스키마 설계의 대표 사례다. [S1]

💻 코드 패턴 (Code patterns)

Column with dual-purpose auto-updating timestamp (SQL):

CREATE TABLE MyGuests (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    firstname VARCHAR(30) NOT NULL,
    lastname VARCHAR(30) NOT NULL,
    email VARCHAR(50),
    reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)

검증 상태 및 신뢰도

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

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-07-04: Initial draft synthesized from the W3Schools "PHP MySQL Create Table" page (Astra wiki-curation, P-Reinforce v3.1 format).