Originally published at Ramblings from the Flip Side (Site under construction). You can comment here or there.

Here’s an argument for taking math classes, whether you are male or female. It really will help you with your future jobs. And yes, I laughed at that one too when I was a kid. Now I know better.

The intro to television series Numb3rs includes the lines “We all use math every day… We use math to [...] reveal patters and predict behavior.” It’s actually a good point. Logic, math, and numbers are essential to doing many things in life, especially in regards to being a database administrator. You don’t have to be a math expert to be a DBA, but it helps if you understand arithmetic functions and precedence. The ability to work through story problems is very similar to working through work issues. And understanding granularity is essential.

Let’s start with precedence. 2 + 3 = 5. And 2 + 3 – 4 will always equal 1. Precedence in math and SQL is identified by the use of parenthesis. Everything is operated on from the inside heading to the outside. So we have two possible formulas: (2 + 3) – 4 or 2 + (3 – 4).

Here’s the difference

We start with (2 + 3) – 4 and work the parens first. The formula becomes (5) – 4. Then 5 – 4 = 1.

We start with 2 + (3 – 4) and work the parens first. The formula becomes 2 + (-1) where the addition gets changed to a minus due to the presence of a negative number. So now we have 2 – 1 (which is the same as 2 + -1) = 1.

Precedence becomes really important in cases of the division and multiplication operands: * or /. So when we have a formula like 2 + 3 * 4, our two possibilities are either (2 + 3) * 4 or 2 + (3 * 4). Now we have 2 possible answers, that of 20 or that of 14.

(2 + 3) * 4 becomes (5) * 4 becomes 20.

2 + (3 * 4) becomes 2 + (12) becomes 14.

But precedence in SQL Server is about more than mathematical formulas in reports. It makes a difference in how one treats JOIN or WHERE clauses. If I’m looking for order invoices for a customer called XYZ Soup Company, I’m might start looking in the customer table or the order table or the invoice table. If I can do an INNER JOIN on all of these tables (each table has a key that leads logically to the next table) it doesn’t matter where I start. But if I need to find order invoices for this customer that do not match up to the orders actually placed by the customer, I might start at the customer table and join up to the invoice table before doing an OUTER JOIN to the orders table in order to check for a state of non-existence.

Such a query sounds complicated and, depending on the database’s design, it might be. This is where understanding story problems come in handy, and maybe some geometry skills as well. The ability to picture the tables and their connections in your head, or to draw it out on paper, is important to resolving the problems DBAs experience in the everyday workplace. It’s not just about creating financial reports or adding quarterly totals. DBAs also use math to analyze trends, budget hard disk space, troubleshoot performance issues, and verify data flows. Again, though, you don’t need to be a math major to do this job. The ability to internalize math principals in the job are key.

Let me explain. Math is intuitive (and yes, I’ve heard the arguments for why it’s not, but I disagree). Personally, I can’t do math if I concentrate on each and every step of the problem. But I can generally get from the problem to the correct answer if I don’t have to show my work. Math is so “internalized” in what I do, that until I actually follow a math formula to discover a problem, I don’t think about my job as a “math job.” It’s just a job that occasionally requires me to think in math terms. So the idea that I need math and mathematical concepts to do my job amuses me. I only took advanced math courses in high school because I heard a rumor that if I took calculus in 12th grade I wouldn’t need to take math in college. It was just an old wives’ tale, I found out later. I’m glad, however, that I fell for it. As average a math student as I was, these courses have helped me greatly with every job I’ve ever held and are crucial to the job I have now.

So don’t neglect your math education. You’d be amazed at what it can do for you, even when you aren’t thinking about it.

## Comments