Posted by: vivekwin on: July 24, 2008
The Mysql SELECT command is something like a print or write command of other languages..
Displaying the MySQL version number
select version(); +-----------+ | version() | +-----------+ | 5.00.00 | +-----------+ 1 row in set (0.00 sec)
Displaying the current date and time
select now(); +---------------------+ | now() | +---------------------+ | 2008-05-31 00:36:24 | +---------------------+ 1 row in set (0.00 sec)
Displaying the current Day, Month and Year
SELECT DAYOFMONTH(CURRENT_DATE); +--------------------------+ | DAYOFMONTH(CURRENT_DATE) | +--------------------------+ | 5 | +--------------------------+ 1 row in set (0.01 sec) SELECT MONTH(CURRENT_DATE); +---------------------+ | MONTH(CURRENT_DATE) | +---------------------+ | 2 | +---------------------+ 1 row in set (0.00 sec) SELECT YEAR(CURRENT_DATE); +--------------------+ | YEAR(CURRENT_DATE) | +--------------------+ | 2008 | +--------------------+ 1 row in set (0.00 sec)
Displaying text strings
select 'I am MySQL'; +--------------+ | I am MySQL | +--------------+ | I am MySQL | +--------------+ 1 row in set (0.00 sec)