• Set based languages are declarative. You tell sql server WHAT you want not how to do it.

    "I want the set of customers who ordered more than $100 last month unioned with the top 200 customers from last year by total number of orders"

    In a procedural language, you tell it HOW to calculate the results. So, you would need loop through all the orders for last month, summing them up , then you'd need to count the total orders for every customer last year, sort them, keep the top 200, and return the unique customers.

    The key to becoming proficient in sql is being able to express the "WHAT" while letting Sql Server worry about the "HOW".

    Also, pure set based logic doesn't use loops. So, if you find yourself wanting to loop over rows, you are not taking a set based approach.