我的應用程序獲取書籍並將這本書的每個單詞插入數據庫,它可能在書中有超過1億個單詞並插入到數據庫中。 現在我想要獲得與上一個和下一個單詞的特定單詞。 獲得結果的時間非常重要。獲取具有特定條件的選定行的行之前和之後
舉例說: 「這本書的話在這個表中插入此處...」
------------------------------
| ID | word |
------------------------------
| 1 | the |
| 2 | book |
| 3 | words |
| 4 | insert |
| 5 | here |
| 6 | in |
| 7 | this |
| 8 | table |
| . | . |
| . | . |
| . | . |
------------------------------
或其他例如:
------------------------------
| ID | word |
------------------------------
| 1 | my |
| 2 | name |
| 3 | is |
| 4 | joseph |
| 5 | and |
| 6 | my |
| 7 | father |
| 8 | name |
| 9 | is |
| 10 | brian |
------------------------------
我想過去和未來同一單詞的值
例如,我想獲取「name」的前一個和下一個單詞:
--------------------------
| my | name | is |
--------------------------
| father | name | is |
--------------------------
其他相關崗位的朋友
寫代碼,但是這個代碼需要很長時間才能得到結果,我想快速得到結果表:
相關信息:[提問] Get previous and next row from rows selected with (WHERE) conditions
多久做你計劃運行該查詢RY? – 2014-11-25 08:50:02