In order to determine which MySQL version you're running you can type the following command:
# mysql -V
mysql Ver 14.7 Distrib 4.1.11, for pc-linux-gnu (i386)
# mysql -V
mysql Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (i486) using readline 5.2
Now, if you want to query for the version number while beign logged in (PHP script for example), just go with:
SELECT VERSION(); .
I believe this is only working since MySQL 4 though.
"A sure sign of my descent into senility is bitchin' and moanin' about "kids these days," and how they won't or can't do anything hard any more."
So goes the intro to Joel's "The Perils of JavaSchools".
Higly relevant and highly recommended, as usual! ;)
"Pointers and recursion require a certain ability to reason, to think in abstractions, and, most importantly, to view a problem at several levels of abstraction simultaneously. And thus, the ability to understand pointers and recursion is directly correlated with the ability to be a great programmer.
You need training to think of things at multiple levels of abstraction simultaneously, and that kind of thinking is exactly what you need to design great software architecture."
Among other things, Joel talks about how Universities made the mistake of replacing courses on C pointers and recursion with courses on simple Java... and those universities include UPenn... my second most enjoyable experience in the 90ies (the most enjoyable one being the bubble of course! ;D)
Also, Joel talks about how it gets difficult to distinguish the top programmers from the average because you can't ask them about pointers & recursion right out of school any longer... I've got the same issue with database programmers. You can't ask them about concurrent transactions and normalizing databases any longer... Ironically, I learnt most of that at UPenn... back then in the 90ies... :>>
MySQL offers pretty useful functions when you want to manipulate days:
- You can add a time interval to a date value with ADDDATE() or DATE_ADD()
- You can subtract a time interval from a date value witf DATE_SUB()
- You can find the interval between two dates with DATEDIFF()
It's often easier to compute this stuff directly in MySQL rather than in PHP.
For all date functions see the MySQL Manual.