Write SQL queries for sales analysis
Generate optimized SQL queries for comprehensive sales data analysis based on your specific tables and needs.
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
Je travaille avec une base de données [TYPE_BDD] (PostgreSQL / MySQL / BigQuery / Snowflake) contenant les tables suivantes : - [TABLE_1] : [DESCRIPTION_TABLE_1] avec les colonnes [COLONNES_1] - [TABLE_2] : [DESCRIPTION_TABLE_2] avec les colonnes [COLONNES_2] - [TABLE_3] : [DESCRIPTION_TABLE_3] avec les colonnes [COLONNES_3] J'ai besoin d'analyses sur [PERIODE] pour [OBJECTIF_ANALYSE]. Ecris les requêtes SQL pour : 1. Le chiffre d'affaires total par [DIMENSION] avec variation vs période précédente 2. Le top 10 des [ENTITE] (produits / clients / régions) par [METRIQUE] 3. L'évolution mensuelle avec moving average sur [N] mois 4. La cohorte de clients par mois d'acquisition et leur valeur cumulée 5. La détection des anomalies (valeurs > 2 écarts-types de la moyenne) 6. Un rapport récapitulatif avec toutes les métriques en une seule requête Optimise les requêtes pour les performances et ajoute des commentaires explicatifs. Indique les index recommandés.
Why this prompt works
<p>The prompt works because it specifies the exact database structure, enabling generation of directly usable queries. The request for optimization and comments ensures professional quality.</p>
Use Cases
Expected Output
6 commented SQL queries, optimized for performance, with index recommendations.
Learn more
Check the full skill on Prompt Guide to master this technique from A to Z.
View on Prompt Guide📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Similar Prompts
Getting started with Python and Pandas for analysis
Complete beginner guide to data analysis with Python Pandas, from data loading to first visualizations.
Conversion funnel analysis
Exhaustive conversion funnel analysis with friction point identification and A/B test recommendations.
Advanced Excel formulas for data analysis
Provides advanced Excel formulas tailored to specific analysis problems with explanations and variants.
Data cleaning and preparation
Step-by-step guide to clean and standardize raw data before analysis in Excel or Google Sheets.