Notes MySQL Command select: the currently selected (connected) database

Source: Internet
Author: User
Tags mysql version

the Select command represents the currently selected (connected) database.

SELECT command format:mysql> Select Database ();

The Select command in MySQL is similar to print or write in other programming languages, and you can use it to display the results of a string, a number, a mathematical expression, and so on. How do I use the special features of the Select command in MySQL?

1) Show MySQL version
mysql> Select version ();
+-----------------------+ 
| version () |
+-----------------------+ 
| 6.0.4-alpha-community |
+-----------------------+ 
1 row in Set (0.02 sec)

2) Show current time
mysql> Select Now ();
+---------------------+ 
| Now () |
+---------------------+ 
| 2009-09-15 22:35:32 |
+---------------------+ 
1 row in Set (0.04 sec)

3) Display Month Day
SELECT DayOfMonth (current_date);
+--------------------------+ 
| DayOfMonth (current_date) |
+--------------------------+ 
| 15 |
+--------------------------+ 
1 row in Set (0.01 sec)
  
SELECT MONTH (current_date);
+---------------------+ 
| MONTH (current_date) |
+---------------------+ 
| 9 |
+---------------------+ 
1 row in Set (0.00 sec)
  
SELECT Year (current_date);
+--------------------+ 
| Year (current_date) |
+--------------------+ 
| 2009 |
+--------------------+ 
1 row in Set (0.00 sec)

4) Display string
mysql> Select "Welecome to my blog!";
+----------------------+ 
| Welecome to my blog! |
+----------------------+ 
| Welecome to my blog! |
+----------------------+ 
1 row in Set (0.00 sec)

5) When the calculator uses
Select ((4 * 4)/ten) +;
+----------------------+ 
| ((4 * 4)/10) + 25 |
+----------------------+ 
| 26.60 |
+----------------------+ 
1 row in Set (0.00 sec)

6) Threaded string
Select CONCAT (F_name, "", L_name)
As Name
From Employee_data
where title = ' Marketing Executive ';
+---------------+ 
| Name |
+---------------+ 
| Monica Sehgal |
| Hal Simlai |
| Joseph Irvine |
+---------------+ 
3 rows in Set (0.00 sec)

Note: the concat () function is used here to string strings together. In addition, we used the previously learned as to give the result column ' CONCAT (f_name, "", L_name) ' a pseudonym.

Notes MySQL Command select: the currently selected (connected) database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.