database-schema-design by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill database-schema-design设计具有适当关系、约束和数据类型的可扩展、规范化的数据库模式。包括规范化技术、关系模式和约束策略。
PostgreSQL - 消除重复组:
-- NOT 1NF: repeating group in single column
CREATE TABLE orders_bad (
id UUID PRIMARY KEY,
customer_name VARCHAR(255),
product_ids VARCHAR(255) -- "1,2,3" - repeating group
);
-- 1NF: separate table for repeating data
CREATE TABLE orders (
id UUID PRIMARY KEY,
customer_name VARCHAR(255),
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE order_items (
id UUID PRIMARY KEY,
order_id UUID NOT NULL,
product_id UUID NOT NULL,
quantity INTEGER NOT NULL,
FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE
);
references/ 目录下的详细实现:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 指南 | 内容 |
|---|---|
| 第一范式 (1NF) | 第一范式 (1NF) |
| 第二范式 (2NF) | 第二范式 (2NF) |
| 第三范式 (3NF) | 第三范式 (3NF) |
| 实体-关系模式 | 实体-关系模式 |
每周安装次数
147
代码仓库
GitHub 星标数
116
首次出现时间
Jan 21, 2026
安全审计
安装于
opencode128
gemini-cli123
claude-code122
codex119
cursor114
github-copilot105
Design scalable, normalized database schemas with proper relationships, constraints, and data types. Includes normalization techniques, relationship patterns, and constraint strategies.
PostgreSQL - Eliminate Repeating Groups:
-- NOT 1NF: repeating group in single column
CREATE TABLE orders_bad (
id UUID PRIMARY KEY,
customer_name VARCHAR(255),
product_ids VARCHAR(255) -- "1,2,3" - repeating group
);
-- 1NF: separate table for repeating data
CREATE TABLE orders (
id UUID PRIMARY KEY,
customer_name VARCHAR(255),
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE order_items (
id UUID PRIMARY KEY,
order_id UUID NOT NULL,
product_id UUID NOT NULL,
quantity INTEGER NOT NULL,
FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE
);
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| First Normal Form (1NF) | First Normal Form (1NF) |
| Second Normal Form (2NF) | Second Normal Form (2NF) |
| Third Normal Form (3NF) | Third Normal Form (3NF) |
| Entity-Relationship Patterns | Entity-Relationship Patterns |
Weekly Installs
147
Repository
GitHub Stars
116
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode128
gemini-cli123
claude-code122
codex119
cursor114
github-copilot105
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
118,000 周安装