Create intermediate Works with: Any AI

SQL Stored Query Library With Comments and Parameters

Structured brief

Organise reusable queries for a team.

The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.

Rate this prompt

Loading ratings…

Create a query library structure for a team using SQL. Common questions the team answers: [QUESTIONS]. Database system: [DATABASE]. Who writes and reviews queries: [PEOPLE].

A colleague should trust and reuse a query without asking its author. Define folder and file naming (for example reporting_monthly_revenue_by_product.sql), a header comment template (purpose, author, date, inputs, output columns, assumptions, last tested), parameter conventions (start_date and end_date, never hard-coded dates), formatting rules (keywords upper case, one clause per line, comments for non-obvious logic), a review checklist of eight questions (correct joins, filters, null handling, performance), and where the library lives in a repository with proposals through review. Write three example headers for invented queries, with no personal data in examples, and access limits. Add a monthly review of unused queries. Include a short rule on retiring queries that are no longer used and on recording who relied on each one, so nothing is deleted that another team depends on. Say how a new team member finds the right query without asking, for example through an index file listing each query with its purpose, owner and last tested date. Keep the whole structure simple enough that a team of three will keep it up to date.

Fill in before use

Optional: type your details and the prompt above updates. Nothing is saved or sent.

Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.

Related prompts