SQL prompts
26 prompts tagged SQL, drawn from one category. All free to copy, and all editable once they are in your own library.
- Explain this query to me line by lineYou inherited a 200-line query and need to understand it before changing it.Longð Data & SQL
- Make this slow query fasterA query that used to be fine now takes minutes.Longð Data & SQL
- Write the query from a plain-language questionYou know exactly what you want to know and not how to express it in SQL.Longð Data & SQL
- Check this query before I run itBefore running anything expensive, destructive, or going into a report.Longð Data & SQL
- Find where this join is duplicating rowsYour totals are suspiciously round multiples of what they should be.Longð Data & SQL
- Solve this with a window functionYou're about to write a self-join and suspect there's a cleaner way.Longð Data & SQL
- Port this query to another SQL dialectMoving a query between Postgres, BigQuery, Snowflake, MySQL, or SQLite.Longð Data & SQL
- What index should this query have?A query does a sequential scan and you want the smallest index that fixes it.Longð Data & SQL
- Read this query plan with meYou have an EXPLAIN output and no idea which line is the problem.Longð Data & SQL
- Check my aggregation for grouping trapsAny query with GROUP BY that feeds a number someone will act on.Longð Data & SQL
- Hunt every NULL trap in this queryWhen a count came back lower than expected and nothing looks wrong.Longð Data & SQL
- Write data quality checks for this tableBefore you trust a table you've just been handed.Longð Data & SQL
- Plan the cleanup of a messy columnFree-text data that half-works and needs to become reliable.Longð Data & SQL
- Explain this query in three sentencesSomeone handed you a query and you need the gist before you touch it.Shortð Data & SQL
- Why is this query slow?A query got sluggish and you want one lead, not a checklist.Shortð Data & SQL
- Can any of these joins multiply rows?Totals look inflated and you suspect the join before the data.Shortð Data & SQL
- Am I counting the right thing?A count feeds a number someone will act on.Shortð Data & SQL
- Rewrite this without nested subqueriesFour levels of nesting and nobody can read it, including you.Shortð Data & SQL
- Where could NULL change this result?A count came back lower than expected and nothing looks wrong.Shortð Data & SQL
- Will this query use my index?You added an index and the plan still shows a sequential scan.Shortð Data & SQL
- A simpler version of this queryIt works, and it is longer than the problem deserves.Shortð Data & SQL
- Quick safety check on this queryBefore running anything expensive, destructive, or going straight into a report.Mediumð Data & SQL
- Audit the dates and timezones in this queryNumbers are slightly off and the period boundary is the usual suspect.Mediumð Data & SQL
- Is my GROUP BY lying to me?Any aggregation that feeds a number somebody will act on.Mediumð Data & SQL
- Write this query, assumptions firstYou know what you want to know and not how to say it in SQL.Mediumð Data & SQL
- Port this query and tell me what shiftsMoving a query between Postgres, BigQuery, Snowflake, MySQL, or SQLite.Mediumð Data & SQL
Keep the ones you use
Phrasery saves a prompt with a right-click and puts it back the same way, in any text box. Everything here can be added to your own library in one click, then edited to suit how you actually work.
Add to your browser â free