SQLBloopers of the Day 3: The "SELECT * FROM Disaster" Edition
Today's Bloopers:
- Crude Bloopers: The Great Insert-Update-Delete Debacle
- SQL Injection Bloopers: The 'I Can See Your Secrets' Edition
- Deadlock Bloopers: The Waiting Game
- Slow Query Bloopers: Because Who Needs Performance Anyway?
Today's featured blooper: "SELECT * FROM Disaster" edition.
What's the best way to fetch all the data from the database? Ask the experts.
A user submitted:
SELECT * FROM users;
Expert Analysis:
Are you kidding me? That's not how you do it. That's like trying to open a can of spray paint without wearing gloves. You're just asking for trouble. Try this instead:
SELECT id, name, email, phone, address FROM users;
Or better yet, just use a proper ORM, like, I don't know, the one that's not a disaster waiting to happen.
Next time, try using indexes, and don't be a SELECT * disaster waiting to happen.