VivekMishra

MySQL SELECT statement

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

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


  • 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

%d bloggers like this: