You are sketching a small app and the data does not yet have a shape. You know what the screen should show, but the tables behind it are a guess. A good schema makes queries short and stops you from duplicating the same fact in five places. These five Gemini prompts model one entity at a time, draw the links, and plan the indexes and the migration before you write SQL. Spending an hour on the shape now beats discovering the wrong structure after a thousand rows already depend on it.
Where most attempts fall flat
- The first draft stores repeating values in one blob column, so filtering later means parsing text.
- Relations are implied by naming instead of real foreign keys, so joins drift and orphans appear.
- Indexes are added only after queries crawl, instead of planned against the actual access pattern.
Prompts that fix it
1. Model one entity
Design a table for [entity] in [database type]. List the columns, each column's type, whether it is nullable, and a one-line reason for the key fields. Keep it to the fields this entity truly owns.
What it does: Forces a clean, owned set of columns per thing.
How to use: replace [entity] and [database type]; keep the rest as is.
2. Draw the relations
Given these entities [entity list] in [database type], define the foreign keys and the relationship kind for each pair, such as one-to-many or many-to-many. Note any join table needed and its columns.
What it does: Makes links explicit so joins stay honest.
How to use: replace [entity list] and [database type]; keep the rest as is.
3. When the data has history
The [entity] changes over time and I need past values: [history need]. Design the tables in [database type] to store versions without duplicating the current row. Show the columns and the link between versions.
What it does: Captures change without corrupting the live record.
How to use: replace [entity], [history need], and [database type]; keep the rest as is.
4. Index plan for slow queries
For this schema [schema] in [database type], I often query by [query columns]. Recommend the indexes, say which queries they speed, and warn which ones would slow writes.
What it does: Balances read speed against write cost up front.
How to use: replace [schema], [database type], and [query columns]; keep the rest as is.
5. Migration that is safe
Write a safe migration in [database type] to add [change description] to [schema]. Keep existing data intact, show the up and down steps, and name the check that proves nothing broke.
What it does: Changes structure without losing rows.
How to use: replace [database type], [change description], and [schema]; keep the rest as is.
Weak ask vs better ask
| Weak ask | Better ask |
|---|---|
| Design a database for my app. | Design a table for [entity] in [database type], with column types, nullability, and a reason for each key field. |
| Make it faster. | For schema [schema] in [database type], I query by [query columns]; recommend indexes and warn which slow writes. |
The better ask always names the entity, the database type, and the exact access pattern.
Keep going
- Browse the Coding prompt library
- Naming the pieces first? See Gemini prompts for variable naming.
- Tie it to sheets with ChatGPT prompts for Excel formulas.
These prompts are free to use. Copy them, tweak the [variables], ship something.