Displaying the MySQL version number
select version();
+———–+
| version() |
+———–+
| 3.22.32 |
+———–+
1 row in set (0.00 sec)
Displaying the current date and time
select now();
+———————+
| now() |
+———————+
| 2001-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) |
+————————–+
| 28 |
+————————–+
1 row in set (0.01 sec)
SELECT MONTH(CURRENT_DATE);
+———————+
| MONTH(CURRENT_DATE) |
+———————+
| 1 |
+———————+
1 row in set (0.00 sec)
SELECT YEAR(CURRENT_DATE);
+——————–+
| YEAR(CURRENT_DATE) |
+——————–+
| 2001 |
+——————–+
1 row in set (0.00 sec)
Displaying text strings
select ‘I Love MySQL’;
+————–+
| I Love MySQL |
+————–+
| I Love MySQL |
+————–+
1 row in set (0.00 sec)
ref : http://www.webdevelopersnotes.com/tutorials/sql/a_little_more_on_the_mysql_select_statement.php3