1. What Is SQL and Why Analysts Need It
1.5 How Analysts Use SQL at Work (Retail, Bank, Clinic Stories)
Why. SQL feels abstract until you hear work stories.
What. Analysts use SQL to filter sales, join customers, and build clean tables for Excel or Power BI.
How. Retail: coffee orders by city. Bank: transactions above a limit. Clinic: appointments this week. Same SQL patterns.
Steps
- Retail story: Pune sales this month → WHERE city + date.
- Bank story: Transfers over 500 USD → WHERE amount.
- Clinic story: Open tickets → WHERE status.
Examples
Example 1 · dataset: raja_coffee
SELECT city, COUNT(*) AS orders
FROM orders
GROUP BY city
ORDER BY orders DESC;Output
| city | orders |
|---|---|
| Pune | 10 |
| Nashik | 3 |
| Mumbai | 3 |
| Kolhapur | 3 |
| Goa | 3 |
| Solapur | 2 |
Meaning. Retail story in one query: how many orders per city.
Ravindra Bagale's Tip
Write the business question in one sentence before you write SQL.
Ravindra Bagale's Tip – मराठी
SQL लिहिण्याआधी व्यवसायाचा प्रश्न एका वाक्यात लिहा.
Ravindra Bagale's Tip – हिंदी
SQL लिखने से पहले बिज़नेस सवाल एक वाक्य में लिखें।