Log in

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.

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

It’s been a while since I did a post about my day job, so I thought it was about time. The subject? Math. Everyone likes to hear about math, right?

You remember all those classes in high school and college where you had to do all that fancy equation stuff, and you found yourself thinking “I’ll never use that!” Well, if you get into technology or actuarial work, you will use “that.” And here I am, a database administrator learning PHP and being reminded that Whole Numbers, Real Numbers, and parentheses are indeed important to my current work. So here’s the quiz…

What is the sum of 1 + 3 * 6 + 1?

The answer may not be what you think. SQL Server, and many other programs, do multiplication and division first, before addition and subtraction. So the correct answer is 20.

3 * 6 = 18 which becomes 1 + 18 + 1 = 20.

But what if you put in parens? The answer may change, depending on where you put in the parens because the values inside the parens gets calculated before the multiplication & division are applied to the parens value. Try this on for size:

1 + (3 * 6) + 1 = 20 –This is how the computer sees it.

1 + 3 * (6 + 1) = 22 –The computer multiplies times the value in parens, which is 7. 1 + 3 * (7) becomes 1 + 21 becomes 22.

(1 + 3) * 6 + 1 = 25 — (4) * 6 + 1 becomes 24 + 1 becomes 25.

(1 + 3) * (6 + 1) = 28 — (4) * (7) is what this becomes.

Same formula, 4 different answers. Wow. Clear as mud, right? Just remember, when coding formulas for a report or a feed or even a calculated column, precedence matters. If you mistype your parens, or forget to put them in, you may end up with a completely different value than you intend to get.

Double-check any formulas (and their results) with your business users to make sure they are getting the values they expect to see. And if they aren’t, make them define the formula for you. If they don’t know what the formula is, then you will never be able to give them the answer that they want (or need) to see.

Brandie's Stories

The Monster of Mogahnee Bay (reprint ebook, Coming Soon, Musa Publishing)

The Drunkard's Progress (Coming Soon, Musa Publishing)

Slipping Thru the Cracks, Latchkeys #7 (Sept 2012 Crazy 8 Press)

Legend of the Beemen (June 2012 Musa Publishing)

Feast of the Torn (upcoming Buzzy Magazine)

The Hunt for Liberty Jones (Space Tramps, Flying Pen Press)

The Tales We'll Tell Tomorrow (Shadowrun: Street Legends, Catalyst Game Labs)

Silk and Steam (The Ladies of Trade Town, HarpHaven Press)

Love Me Knot (A Lady Katya Story, Storyportals.com)

Another Day, Another Labor (A Career Guide to Your Job in Hell)

Locke-Down (Blue Kingdoms: Mages & Magic)

The Rose Garden (Shadowrun: Corporate Guide-Mitsuhama Fiction, Catalyst Game Labs)

The Monster of Mogahnee Bay (Blue Kingdoms: Shades & Specters)

Just My Luck (Pirates of the Blue Kingdoms)

Two for the Price of One (Transformers: Legends, iBooks Inc.)

Latest Month

October 2015
Powered by LiveJournal.com
Designed by Tiffany Chow