MySQL进入查询
官网地址:https://dev.mysql.com/doc/refman/8.0/en/entering-queries.html
最近开始通读官方文档,可以学习到好知识,记录下来
SELECT VERSION(), CURRENT_DATE; +-----------+--------------+ | VERSION() | CURRENT_DATE | +-----------+--------------+ | 5.8.0-m17 | 2015-12-21 | +-----------+--------------+ 1 row in set (0.02 sec) mysql>
Keywords may be entered in any lettercase. The following queries are equivalent:
mysql> SELECT VERSION(), CURRENT_DATE; mysql> select version(), current_date; mysql> SeLeCt vErSiOn(), current_DATE;
Here is another query. It demonstrates that you can use mysql as a simple calculator:
SELECT SIN(PI()/4), (4+1)*5; +--------------------+---------+ | SIN(PI()/4) | (4+1)*5 | +--------------------+---------+ | 0.7071067811865475 | 25 | +--------------------+---------+ 1 row in set (0.00 sec)
还可以这样输入
SELECT VERSION(); SELECT NOW(); +-----------------+ | VERSION() | +-----------------+ | 5.6.24-72.2-log | +-----------------+ 1 row in set (0.00 sec) +---------------------+ | NOW() | +---------------------+ | 2018-05-25 09:11:21 | +---------------------+ 1 row in set (0.00 sec)
\c取消您输入的代码
(system@localhost:mysqld.sock) [(none)]> select user -> () -> \c
Prompt Meaning mysql> Ready for new query -> Waiting for next line of multiple-line query '> Waiting for next line, waiting for completion of a string that began with a single quote (') "> Waiting for next line, waiting for completion of a string that began with a double quote (") `> Waiting for next line, waiting for completion of an identifier that began with a backtick (`) /*> Waiting for next line, waiting for completion of a comment that began with /*
例子
mysql> SELECT * FROM my_table WHERE name = 'Smith AND age < 30; '>
最后quit退出
> quit Bye
写的不好,请大家批评指正