What is the function of the SELECT command in MySQL
Today, I will talk to you about the role of the SELECT command in MySQL, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
How to use the special features of the SELECT command in MySQL
1. Display the version of MYSQL
Mysql > selectversion (); +-+ | version () | +-- + | 6.0.4-alpha-community | +-+ 1rowinset (0.02sec)
two。 Show current time
Mysql > selectnow (); +-+ | now () | +-+ | 2009-09-1522 1rowinset 35 1rowinset (0.04sec)
3. Show year, month and day
SELECTDAYOFMONTH (CURRENT_DATE); +-- + | DAYOFMONTH (CURRENT_DATE) | +-- + | 15 | +-+ 1rowinset (0.01sec) SELECTMONTH (CURRENT_DATE) +-+ | MONTH (CURRENT_DATE) | +-+ | 9 | +-+ 1rowinset (0.00sec) SELECTYEAR (CURRENT_DATE) +-+ | YEAR (CURRENT_DATE) | +-+ | 2009 | +-+ 1rowinset (0.00sec)
How to use the special features of the SELECT command in MySQL
4. Display string
Mysql > SELECT "welecometomyblog!"; +-- + | welecometomyblog! | +-- + | welecometomyblog! | +-- + 1rowinset (0.00sec)
5. Used as a calculator
Select ((4) 4) / 10) + 25 (4) / 10) + 25 | (4 / 4) / 10) + 25 | +-- + 1rowinset (0.00sec)
6. Concatenated string
SelectCONCAT (f_name, ", l_name) ASNamefromemployee_datawheretitle='MarketingExecutive';+-+ | Name | +-+ | MonicaSehgal | | HalSimlai | | JosephIrvine | +-+ 3rowsinset (0.00sec)
Note: the CONCAT () function is used here to concatenate strings. In addition, we used the AS we learned before to give the result column 'CONCAT (f_name, ", l_name) a pseudonym.
After reading the above, do you have any further understanding of the function of the SELECT command in MySQL? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.