Design a Database Schema

CREATE TABLE statements with constraints, indexes, and the reasoning behind each choice.

Advanced1 min read
Languages
SQL

Customize

Fill these in and the prompt below updates as you type. Anything you leave blank stays as a placeholder.

Which engine this runs on

The business area this code serves

What the solution must satisfy, listed out

Your prompt

Design a {{database}} schema for the following domain.

Domain description:
{{domain}}

Requirements:
{{requirements}}

Output:
- CREATE TABLE statements with constraints and indexes
- Brief explanation of key design decisions
- Any denormalization choices and why

Similar prompts

Optimize a Slow Query

Read the execution plan, name the real bottleneck, and get a rewrite plus the exact index to add.

Break a God Function Apart

Split an oversized function into well-named pieces without changing external behavior.

Design a REST API

Endpoint-by-endpoint design including the error responses most API specs forget.

Design a System Component

A component design with data model, API surface, the hard parts, and what to defer to v2.