I have been writing my little blog here for some time now, and my favorite part of doing this is of course the feedback. It's always great to hear from the readers, to have mistakes corrected, to debate various topics and techniques, and to learn a lot about SQL and the various topics I discuss here.
At this point, I have received over 1,700 comments over the years, and while all of them are truly appreciated, I have noticed that unfortunately many of the, uh, less helpful comments do seem to consistently fall neatly into various categories.
Let's take a look at an example of a simple, typical blog post and some of the responses that often come back. If you write a blog of your own, or often read the feedback from other blogs, many of these may seem familiar to you.
A Typical Blog Post
Today, I have a simple tip for beginner SQL programmers. When writing a SELECT, you can add a WHERE clause to filter the results that are returned.
Some Typical Responses
For example, to only return rows for CustomerID 345, you can write:
WHERE CustomerID = 345
As you can see, it is very simple. You can use any boolean expression to filter the results as needed. Try it out! If you have any questions, let me know.
The subtle blog spammer (that you initially mistake for a nice complement):
Very helpful site! Good advice! From Joe at www.some-random-site-that-has-nothing-to-do-with-sql.com
The person who doesn't seem to get it:
Ummm ... what good does this do when I want to sort? You should fix the code.
The person that really
doesn't get it:
The problem with that is it will only return results for one customer.
The person that somehow takes away the exact opposite
of what you wrote:
I disagree, this will not return all customers other than 345 and this is definitely not something for advanced SQL Programmers, it's probably better for beginners.
The script kiddie (who just wants to cut and paste your code, not read or learn anything):
LOL, that doesnt even run 4 me! I get errorz that sez "YourTable" does not exist! Plz help!! thnx!
The very clichéd, mindless "anti-Microsoft ranter":
You only have to use WHERE clauses because Bill Gates wants more $$, you are a shill!! Micro$oft sucks, you should use an iPhone for this! MySQL automagically filters results for you!
The "skimmer" (who just skims the post missing most of it):
Nice, but is there any way to filter for just one customer?
The "repeater" (who just repeats what you've already written):
A better solution is to write WHERE CustomerID = 345, it works better. It is also fast because less rows are returned. Using WHERE is a good way to filter a SELECT.
The "know-it-all complainer":
That is the stupidest advice I ever read, why would you want to ever do this? Just use a parameter, or an ORM tool-- this will not scale! I sure hope CustomerID isn't a VARCHAR -- then you have an implicit conversion happening, your indexes are shot, your server will overheat, and your wife will leave you for your mechanic. Also, 345 is too large if CustomerID is a tinyint.
The random, unrelated question asker:
Good advice. Thnx. How to insert into the table?
If I add this to all of my scripts, only data for one customer will ever be returned. I am not sure this is a good idea. Also, this code will not work in Java and doesn't follow the HTML 4.0 specification.
The very rare polite and helpful typo alerter:
Hey there, you have a typo in the first sentence -- should be "filter", not "fitler"! Just letting you know, thanks for a great post!
The much more common typo alerter:
You wrote FITLER not FILTER, your an idiot!! if you cannot write English how can you write SQL ??? Learn to spell!
Please, don't misunderstand, I mean this all in good fun. I love feedback, and please, keep it coming. It's what makes this and every other blog a fun place to visit.
In fact, I realize that I left out the most annoying feedback of all! That's right, the Thin-Skinned, Overly-Defensive Blog Author Who Feels the Need to Respond to Everything:
Did you even read what I wrote? I did not say that. And, yes, I did spell "monkey" wrong, so sue me! Remind me to fire my editor.... or maybe I should refund your subscription fee? Oh, wait, this blog is free! So what the heck are you complaining about? Why don't you go bother some MySQL blogger? I hear they usually write at a 5th grade level which is probably more appropriate for your intellect. Jerk!
Yeah, comments like those are definitely
the worst of all! Thank you
for putting up with my
feedback, now that I think of it!