VivekMishra

Posts Tagged ‘MySQL SELECT statement

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)
 
Advertisements


  • None
  • Mr WordPress: Hi, this is a comment.To delete a comment, just log in, and view the posts' comments, there you will have the option to edit or delete them.

Categories