I'm new to mySQL and trying to convert a fairly complex program to it.
Most of my tables have an unofficial key which is a timestamp stored as DATETIME, to keep it static.
I would like to take some of my longer, more elaborate perl time-handling functions and use the mySQL built-in ones instead. But I can't seem to find any good guides to doing so. Not on the mySQL site and definitely not in the perl-DBI book (a disappointment to me).
I am trying to figure out probably-simple things like:
- how to get perl to return the results of a
SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y-%m-%d')
...command.
- how to efficiently
SELECT * FROM myTable WHERE {e.g., month=
months before current month, in the datetime column, format YYYY-MM-DD HH:MI:SS}
... using mySQL commands as opposed to some silly hack.
The script is very date-centric and I would love to be doing things RIGHT as opposed doing things kluged.
Does anyone have any suggestions for finding out how to do this gracefully, or even a suggestion of a well-written date-centric mySQL script I could examine?
Thank you for all thoughts!
Most of my tables have an unofficial key which is a timestamp stored as DATETIME, to keep it static.
I would like to take some of my longer, more elaborate perl time-handling functions and use the mySQL built-in ones instead. But I can't seem to find any good guides to doing so. Not on the mySQL site and definitely not in the perl-DBI book (a disappointment to me).
I am trying to figure out probably-simple things like:
- how to get perl to return the results of a
SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y-%m-%d')
...command.
- how to efficiently
SELECT * FROM myTable WHERE {e.g., month=
... using mySQL commands as opposed to some silly hack.
The script is very date-centric and I would love to be doing things RIGHT as opposed doing things kluged.
Does anyone have any suggestions for finding out how to do this gracefully, or even a suggestion of a well-written date-centric mySQL script I could examine?
Thank you for all thoughts!