Database Schema Design
Skill files7 files

references/

scripts/

templates/

SKILL.md86 lines
1
---
2
name: database-schema-design
3
description: >
4
Design database schemas with normalization, relationships, and constraints.
5
Use when creating new database schemas, designing tables, or planning data
6
models for PostgreSQL and MySQL.
7
---
8
9
# Database Schema Design
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Design scalable, normalized database schemas with proper relationships, constraints, and data types. Includes normalization techniques, relationship patterns, and constraint strategies.
22
23
## When to Use
24
25
- New database schema design
26
- Data model planning
27
- Table structure definition
28
- Relationship design (1:1, 1:N, N:N)
29
- Normalization analysis
30
- Constraint and trigger planning
31
- Performance optimization at schema level
32
33
## Quick Start
34
35
**PostgreSQL - Eliminate Repeating Groups:**
36
37
```sql
38
-- NOT 1NF: repeating group in single column
39
CREATE TABLE orders_bad (
40
id UUID PRIMARY KEY,
41
customer_name VARCHAR(255),
42
product_ids VARCHAR(255) -- "1,2,3" - repeating group
43
);
44
45
-- 1NF: separate table for repeating data
46
CREATE TABLE orders (
47
id UUID PRIMARY KEY,
48
customer_name VARCHAR(255),
49
created_at TIMESTAMP DEFAULT NOW()
50
);
51
52
CREATE TABLE order_items (
53
id UUID PRIMARY KEY,
54
order_id UUID NOT NULL,
55
product_id UUID NOT NULL,
56
quantity INTEGER NOT NULL,
57
FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE
58
);
59
```
60
61
## Reference Guides
62
63
Detailed implementations in the `references/` directory:
64
65
| Guide | Contents |
66
|---|---|
67
| [First Normal Form (1NF)](references/first-normal-form-1nf.md) | First Normal Form (1NF) |
68
| [Second Normal Form (2NF)](references/second-normal-form-2nf.md) | Second Normal Form (2NF) |
69
| [Third Normal Form (3NF)](references/third-normal-form-3nf.md) | Third Normal Form (3NF) |
70
| [Entity-Relationship Patterns](references/entity-relationship-patterns.md) | Entity-Relationship Patterns |
71
72
## Best Practices
73
74
### ✅ DO
75
76
- Follow established patterns and conventions
77
- Write clean, maintainable code
78
- Add appropriate documentation
79
- Test thoroughly before deploying
80
81
### ❌ DON'T
82
83
- Skip testing or validation
84
- Ignore error handling
85
- Hard-code configuration values
86

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…