Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Inline IF and CASE statements in MySQL

There are times where running IF statements inside a query can be useful. MySQL provides a simple way to do this through the use of IF and CASE statements.The IF statement takes three arguments; the conditional, the true value and the false value. False and true values may be static values or column values. For example:SELECT IF(score > 100, 100, score) AS scoreFROM exam_resultsthis will return the value in the score column limited to a maximum value of 100. IF statements can also be nested:SELECT IF(score > 100, 100, IF(score < 0, 0, score))FROM exam_resultsCASE statements (s...

8,805 0       SQL CONDITION CASE MYSQK IF


  How Duff’s Device Works

I like C, but I have to admit that, sometimes, “The Old Man of Programming” can be a bit of a killjoy. This is one of the most exciting eras in computer history, but lately, C’s acting like he doesn’t evenwant to have a good time. While the cool kids like Ruby and Haskell are living it up, C’s over in the corner obsessing over bits and bytes and memory alignment and pointers and the stack and machine architecture and unreachable allocations and multiple indirections…and it’s…kind of a buzzkill. You want to tell him, “Dude! Lighten ...

2,379 1       DUFF DEVICE ALGORITHM SWITCH CASE