<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國際加速解決方案。 廣告
                #### 3.3.4.2 選擇特定的行 如上一節所示, 檢索整個表很容易. 只需要從 [`SELECT`](https://dev.mysql.com/doc/refman/8.0/en/select.html) 語句中省略 `WHERE` 子句. 但通常當它變大時, 不希望看到整個表. 相反, 你通常更感興趣的是回答特定的問題, 在這種情況下, 你需要對你想要的信息指定一些約束. 讓我們看看一些選擇查詢, 它們會回答關于你的寵物的問題. 你只能從表中選擇特定的行. 例如, 如果你想驗證對 Bowser 的出生日期所做的更改, 選擇 Bowser 記錄, 如下所示: ```sql mysql> SELECT * FROM pet WHERE name = 'Bowser'; +--------+-------+---------+------+------------+------------+ | name | owner | species | sex | birth | death | +--------+-------+---------+------+------------+------------+ | Bowser | Diane | dog | m | 1989-08-31 | 1995-07-29 | +--------+-------+---------+------+------------+------------+ ``` 輸出確認了年份被正確的記錄為 1989, 而不是 1979. 字符串通常不區分大小寫, 因此你可以將名稱指定為 `'bowser'`, `'BOWSER'` 等等. 查詢結果是相同的. 你可以在任何列上指定條件, 而不僅僅是 `name`. 例如, 如果你想知道那些動物是在 1998 年之后出生的, 測試 `birth` 列: ```sql mysql> SELECT * FROM pet WHERE birth >= '1998-1-1'; +----------+-------+---------+------+------------+-------+ | name | owner | species | sex | birth | death | +----------+-------+---------+------+------------+-------+ | Chirpy | Gwen | bird | f | 1998-09-11 | NULL | | Puffball | Diane | hamster | f | 1999-03-30 | NULL | +----------+-------+---------+------+------------+-------+ ``` 你可以組合條件, 例如, 尋找母狗: ```sql mysql> SELECT * FROM pet WHERE species = 'dog' AND sex = 'f'; +-------+--------+---------+------+------------+-------+ | name | owner | species | sex | birth | death | +-------+--------+---------+------+------------+-------+ | Buffy | Harold | dog | f | 1989-05-13 | NULL | +-------+--------+---------+------+------------+-------+ ``` 前面的查詢使用 [`AND`](https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html#operator_and) 邏輯運算符. 還有 [`OR`](https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html#operator_or) 操作符: ```sql mysql> SELECT * FROM pet WHERE species = 'snake' OR species = 'bird'; +----------+-------+---------+------+------------+-------+ | name | owner | species | sex | birth | death | +----------+-------+---------+------+------------+-------+ | Chirpy | Gwen | bird | f | 1998-09-11 | NULL | | Whistler | Gwen | bird | NULL | 1997-12-09 | NULL | | Slim | Benny | snake | m | 1996-04-29 | NULL | +----------+-------+---------+------+------------+-------+ ``` [`AND`](https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html#operator_and) 和 [`OR`](https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html#operator_or) 可以混合使用, 盡管 [`AND`](https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html#operator_and) 的優先級高于 [`OR`](https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html#operator_or). 如果同時使用這兩個運算符, 最好使用括號來明確表示條件應該如何分組: ```sql mysql> SELECT * FROM pet WHERE (species = 'cat' AND sex = 'm') OR (species = 'dog' AND sex = 'f'); +-------+--------+---------+------+------------+-------+ | name | owner | species | sex | birth | death | +-------+--------+---------+------+------------+-------+ | Claws | Gwen | cat | m | 1994-03-17 | NULL | | Buffy | Harold | dog | f | 1989-05-13 | NULL | +-------+--------+---------+------+------------+-------+ ```
                  <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>

                              哎呀哎呀视频在线观看