Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Mr. Muskrat (4572)

Mr. Muskrat
  reversethis-{moc ... ta} {tarksum.rm}

I'm married with 2 girls. I work as a full time Perl programmer for a Land Mobile Radio company in the Dallas/Fort Worth area.

I am enrolled at the Art Institute of Pittsburgh - Online working towards a Bachelor of Science in photography.

My other blog [blogspot.com]

Journal of Mr. Muskrat (4572)

Tuesday July 12, 2005
11:30 AM

MySQL Typos Can Be Scary

[ #25657 ]

A coworker just showed me a MySQL query that gave him a pretty good scare yesterday.

mysql> SELECT COUNT(*) MISSION_CRITICAL_TABLE;
+------------------------+
| MISSION_CRITICAL_TABLE |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.00 sec)

I did a double take when he showed it to me because I too missed the typo at first. That is a valid MySQL statement that means show me the count of nothing and call it MISSION_CRITICAL_TABLE. You see the 'AS' is optional. What he intended to type was:

mysql> SELECT COUNT(*) FROM MISSION_CRITICAL_TABLE;
+----------+
| COUNT(*) |
+----------+
|  7030295 |
+----------+
1 row in set (0.00 sec)

Okay, you can stop laughing at us now. I just thought that this was something that everyone who uses MySQL should be aware of.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Some ten years ago I an 'UPDATE PRODUCTION_TABLE SET FOO = "BAR"' query to "correct" a mistake that someone else had made. Notice the lack of the WHERE clause ;-) Needless to say I haven't run an UPDATE without first running its SELECT counterpart since.

    -- Douglas Hunter
  • I will never complain about having to add "FROM DUAL" in Oracle again!

    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers