zoukankan      html  css  js  c++  java
  • 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
    

    写的不好,请大家批评指正

     

     

     

     

  • 相关阅读:
    lintcode395-硬币排成线 II
    lintcode-394-硬币排成线
    lintcode-392-打劫房屋
    lintcode-391-数飞机
    lintcode-389-判断数独是否合法
    lintcode-387-最小差
    lintcode-384-最长无重复字符的子串
    lintcode-383-装最多水的容器
    lintcode-382-三角形计数
    爬虫笔记:初始爬虫(二)
  • 原文地址:https://www.cnblogs.com/weiwenbo/p/9086695.html
Copyright © 2011-2022 走看看