TheShiraverseSELECT * TheShiraverseCurriculumPracticeKahaniFAQGet StartedPlaygroundNukteTheShiraverse ↗
Kahani

Will AI replace SQL and data analysts? A story about one wrong number

Imagine a new analyst. Let's call him Rohit. First week, the boss asks: 'How many customers ordered last month?' Rohit is smart, so he asks AI. AI gives him a query in five seconds. The answer: 4 lakh 20 thousand. He puts it in the report. Proud.

Boss, calmBoss
How many customers ordered last month?
Rohit, eagerRohit
SELECT COUNT(*) AS customers
FROM sales.orders;
Scene 1 · the question, and AI's five-second answer
Rohit, proudRohit
4,20,000
customers last month
Done. That was quick.
Scene 2 · the number goes into the report

Meeting time. The director looks at the slide and says: 'Rohit, our whole business has only 3 lakh customers. How did 4 lakh 20 thousand order?' Silence. Rohit's face, red.

!?
Director, shoutingDirector
Rohit, our whole business has only 3 lakh customers. How did 4 lakh 20 thousand order?
4,20,000
?
Rohit, embarrassedRohit
Scene 3 · the meeting

Why was the number wrong?

Look at what the query really counted. Each small tile is one order slip. Click the buttons.

A-1
A-2
A-3
A-4
A-5
B-1
B-2
B-3
B-4
C-1
C-2
C-3

What went wrong? The query counted orders, not customers. One customer, five orders, counted five times. Ginti galat thi, the counting was wrong. The fix is one small word, DISTINCT. But Rohit didn't know that, so he couldn't catch it.

Next day he learned what counting really means. And he still uses AI, every day. But now, when AI hands him a number, he asks: does this make sense? That is the job. AI is Google Maps. It says 'turn left' and left is a lake. The driver who knows the city says: wait. Be that driver. Okay?

RohitRohit
SELECT COUNT(*) AS customers
FROM sales.orders;
Wait. Does this number make sense?
Scene 4 · the next time AI hands him a number
RohitRohit
Checked it. 47,521 real customers.
BossBoss
Scene 5 · the driver who knows the city

See it with real data

Let's not just believe the story. Here is the same mistake, on RetailMart, the practice database of this course. Click the two buttons.

0

Run it yourself in the SQL Playground

One small word, DISTINCT, and the number is right. That is why understanding beats copying.

Want to feel the difference yourself? Open the Playground with the query already typed in, change it, break it, fix it. That is how you learn.

Free SQL course, notes and practice: sql.theshiraverse.com. Questions? Ask in the WhatsApp Community or on Discord. By Shiraj Ahmad. This is my opinion and experience, not professional advice.