Skip to main content

How to create a Minimal, Complete, and Verifiable Example for database-related questions

Database-related questions asking for practical advice will get the most helpful answers if they provide a framework others can use to reproduce that problem.

With that in mind, when asking a question please create a framework that is:

  • Minimal – Use as little code as possible that still produces the same problem
  • Complete – Provide all parts needed to reproduce the problem
  • Verifiable – Test the code you're about to provide to make sure it reproduces the problem


Reducing the code to the bare minimum necessary to convey the problem makes the question easier to ask, and inherently easier to answer. Win-win. If you have a question about a query that has 400 columns, and all 400 columns are not required for the answer, only show the two or three columns that are pertinent to the question.


Include all the tables, queries, indexes, constraints, and other parts as necessary to ensure the person answering your question has all the information at the outset. When including these pieces, provide the SQL scripts so others don't have to recreate them. Do not provide screenshots of tables or results. You can even use an online resource such as db<>fiddle or SQL Fiddle both of which support most major RDBMS platforms and allow you and others to run your example.


Include test output, in text formatted as a table, to show both what you're currently getting as well as what your desired output should be. Search for "ascii table generator" on your favorite search engine - there are several that are extremely easy to use.

An example question, including an MCVE framework

I want to get the total count of the number of ducks in each pond.

The ponds table:

      PondName varchar(30)
      , DuckName varchar(30)

Some sample data:

INSERT INTO ponds (PondName, DuckName)
VALUES ('Golden', 'Daffy')
     , ('Walden', 'Daisy');

My query so far:

FROM ponds;

The output I'm getting:


The output I'd like to get:

Pond Count
Golden 1
Walden 1