Jeff Smith Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server

The Joy of Blog Feedback


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.

For example, to only return rows for CustomerID 345, you can write:

FROM YourTable
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.

Some Typical Responses

The subtle blog spammer (that you initially mistake for a nice complement):

Very helpful site! Good advice!  From Joe at

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?

The "misunderstander":

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!

Legacy Comments

re: The Joy of Blog Feedback
My sentiments exactly!

Don R. Watters
re: The Joy of Blog Feedback
What an idiot! You're a loser Jeff. You totally missed the reformatter!

Everyone knows that you're supposed to do it this way:

FROM YourTable
WHERE CustomerID = 345;

Jack D Corbett
re: The Joy of Blog Feedback
Nice post. It is nice to know that you read the comments. I notice that you have a link to the Red Sox Foundation nicely placed where commenters can see it. I'll have to assume you are a fellow Red Sox fan. That makes me more likely to continue to read your blog.

BTW - I figure anyone who is willing to take the time to try to contribute to the community for nothing should be commended, regardless of the quality of the content. It takes some courage to put your opinions and knowledge out there when there are so many critics.

Bob Hopkins
re: The Joy of Blog Feedback
I hope this will fall into a new category that makes you continue to love comments.

I have learned a tremendous amount from reading your blog over the past several months. In fact, I am back today to completely absorb a post that answers something I have wondered how to do for a long time.

I really appreciate your dedication.

re: The Joy of Blog Feedback
Thanks for the chuckle!

re: The Joy of Blog Feedback
One more (serious) comment about your first response type.

Are you so sure it's spam? I'm a software developer but I'm also into eating right. I blog about how I feed my family healthy food on a budget. I read your blog regularly and usually leave my URL when posting a comment (I'm ashamed to right now because I haven't updated my blog in two weeks.)

Personally I like to click on people's URL's when perusing the comments. Sometimes someone posts something insightful or funny and I wind up sidetracked yet totally delighted with a new find on the web.

Agreed that it's annoying to click on said URL and wind up with a screaming headline promising megabucks working one hour from home ...

re: The Joy of Blog Feedback
LOL funny man ..this is my first time visiting ur blog.. but im pretty sure that i will be visiting here so soon

re: The Joy of Blog Feedback
Hi Mary--

That's the problem -- you never know for sure! Sometimes it is tricky to figure out.

Zack Jones
re: The Joy of Blog Feedback
I tried to run your query in my table but I don't have a column called ... You need to debug your code before posting it for the world to see! :) :) :)

re: The Joy of Blog Feedback
Thanks for the good advice, Jeff, but consider the following:

CREATE VIEW Customer345 AS
FROM Customer
WHERE CustomerID = 345

Your original, complex query now simplifies to

FROM Customer345

which is more readable and easier to maintain. If you happen to have more than one customer in your table (which is rarely the case), I can show you some really cool dynamic sql to create the according views.

Also note that you now have encapsulation and hide implementation details from other users who may want to use your query.

Only thing we have to worry about: what happens if new customers enter the table? Well that's what triggers are for, aren't they? Luckily we only need an INSERT trigger, no need to mess around with UPDATE and DELETE triggers!

Finally, due to our gain in simplicity we don't have to handle confusing stuff like GROUP BY and ORDER BY, since we ensured that our views never contain more than one row!

Hope that helps,

re: The Joy of Blog Feedback
i'm surprised i have not seen your blog sooner via google, other links etc. you have really good stuff! (well not this particular article lol).