<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                `where`的字段必須是表中已有的字段,即使給字段起別名也不可以。 ```sql > select * from student; +-------------+---------------+--------------+--+ | student.id | student.name | student.age | +-------------+---------------+--------------+--+ | 1 | zhangsan | 20 | | 2 | lisi | 21 | | 3 | wangwu | 22 | | 4 | tianqi | 23 | +-------------+---------------+--------------+--+ -- 正常執行! select * from student where id=1; -- 正常執行!where id 是表中的id,不是id+1 as id中的id字段 select *, id as id from student where id=1; -- 因為id_as不是表中已有字段,語句錯誤! select *, id as id_as from student where id_as=1; --正常執行! select * from student where id+1=2; --因為id_one不是表中已有字段,語句錯誤! select *, id+1 as id_one from student where id_one=2; ``` :-: **比較運算符** | 符號 | 支持數據類型 | 描述 | | --- | --- | --- | | A`=`B | 基本數據類型 | 如果 A 等于 B 則返回 `true`,反之返回 `false` | | A`<=>`B | 基本數據類型 | 如果 A 和 B 都為 `NULL`,則返回 `true`,其他的和等號`=`操作符的結果一致,如果任一為`NULL`,則結果為 `NULL` | | A`<>`B,A`!=`B | 基本數據類型 | A 或者 B 為 `NULL` 則返回 `NULL`;<br/>如果 A 不等于B,則返回 `true`,反之返回 `false` | | A`<`B | 基本數據類型 | A 或者 B 為 `NULL`,則返回 `NULL`;如果 A 小于B,則返回 `true`,反之返回 `false` | | A`<=`B | 基本數據類型 | A 或者 B 為 `NULL`,則返回 `NULL`;如果 A 小于等于 B,則返回 `true`,反之返回 `false` | | A`>`B | 基本數據類型 | A 或者 B 為 `NULL`,則返回 `NULL`;如果 A 大于B,則返回 `true`,反之返回 `false` | | A`>=`B | 基本數據類型 | A 或者 B 為 `NULL`,則返回 `NULL`;如果 A 大于等于 B,則返回 `true`,反之返回 `false` | | A `[not] between` B `and` C | 基本數據類型 | 如果 A,B 或者 C 任一為 `NULL`,則結果為 `NULL`。如果 A 的值大于等于 B 而且小于或等于 C,則結果為 `true`,反之為 `false`。如果使用 `NOT`關鍵字則可達到相反的效果。 | | A `is NULL` | 所有數據類型 | 如果A等于`NULL`,則返回`true`,反之返回`false` | | A `is not null` | 所有數據類型 | 如果 A 不等于 `NULL`,則返回 `true`,反之返回`false` | | `in(num1, num2)` | 所有數據類型 | 是否等于`num1`,或`num2`。 | | A `rlike` B, A `regexp` B | string類型 | B 是一個正則表達式,如果 A 與其匹配,則返回 true;反之返回 false。匹配使用的是 JDK中的正則表達式接口實現的,因為正則也依據其中的規則。例如,正則表達式必須和整個字符串 A 相匹配,而不是只需與其字符串匹配。 | | A `[not] like` B | string 類型 |匹配則返回true,否則返回false。<br/>(1)`like 'ABC%'`,匹配以ABC開頭的字符串;<br/>(2)`like '%ABC'`,匹配以ABC結尾的字符串;<br/>(3)`like '%ABC%'`,匹配存在ABC的字符串;<br/>(4)`like '_A%'`匹配第2個字符為A的字符串;<br/>(5)`'like '__A%'`,匹配第3個字符為A的字符串;<br/>(6)`like '%A_'`,匹配倒數第2個是字符A的字符串;<br/>如果使用 `not` 關鍵字則可達到相反的效果。| ```sql (1)查詢出薪水等于 5000 的所有員工 hive (default)> select * from emp where sal =5000; (2)查詢工資在 500 到 1000 的員工信息 hive (default)> select * from emp where sal between 500 and 1000; (3)查詢 comm 為空的所有員工信息 hive (default)> select * from emp where comm is null; (4)查詢工資是 1500 和 5000 的員工信息 hive (default)> select * from emp where sal IN (1500, 5000); (5)查找以 2 開頭薪水的員工信息 hive (default)> select * from emp where sal LIKE '2%'; (6)查找第二個數值為 2 的薪水的員工信息 hive (default)> select * from emp where sal LIKE '_2%'; (7)查找薪水中含有 2 的員工信息 hive (default)> select * from emp where sal RLIKE '[2]'; ``` <br/> :-: **比較運算符** | 符號 | 描述 | | --- | --- | | `and` | 邏輯并 | | `or` | 邏輯或 | | `not` | 邏輯否 | ```sql (1)查詢薪水大于 1000,部門是 30 hive (default)> select * from emp where sal>1000 and deptno=30; (2)查詢薪水大于 1000,或者部門是 30 hive (default)> select * from emp where sal>1000 or deptno=30; (3)查詢除了 20 部門和 30 部門以外的員工信息 hive (default)> select * from emp where deptno not IN(30, 20); ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看