久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='iNIJp'></tfoot>

    <bdo id='iNIJp'></bdo><ul id='iNIJp'></ul>

    1. <small id='iNIJp'></small><noframes id='iNIJp'>

      <legend id='iNIJp'><style id='iNIJp'><dir id='iNIJp'><q id='iNIJp'></q></dir></style></legend>

        <i id='iNIJp'><tr id='iNIJp'><dt id='iNIJp'><q id='iNIJp'><span id='iNIJp'><b id='iNIJp'><form id='iNIJp'><ins id='iNIJp'></ins><ul id='iNIJp'></ul><sub id='iNIJp'></sub></form><legend id='iNIJp'></legend><bdo id='iNIJp'><pre id='iNIJp'><center id='iNIJp'></center></pre></bdo></b><th id='iNIJp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iNIJp'><tfoot id='iNIJp'></tfoot><dl id='iNIJp'><fieldset id='iNIJp'></fieldset></dl></div>

        檢查 MySQL 中日期范圍的重疊

        Check overlap of date ranges in MySQL(檢查 MySQL 中日期范圍的重疊)

              <tbody id='sC3r2'></tbody>

              <tfoot id='sC3r2'></tfoot>

                <bdo id='sC3r2'></bdo><ul id='sC3r2'></ul>

                <legend id='sC3r2'><style id='sC3r2'><dir id='sC3r2'><q id='sC3r2'></q></dir></style></legend>

                  <small id='sC3r2'></small><noframes id='sC3r2'>

                  <i id='sC3r2'><tr id='sC3r2'><dt id='sC3r2'><q id='sC3r2'><span id='sC3r2'><b id='sC3r2'><form id='sC3r2'><ins id='sC3r2'></ins><ul id='sC3r2'></ul><sub id='sC3r2'></sub></form><legend id='sC3r2'></legend><bdo id='sC3r2'><pre id='sC3r2'><center id='sC3r2'></center></pre></bdo></b><th id='sC3r2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='sC3r2'><tfoot id='sC3r2'></tfoot><dl id='sC3r2'><fieldset id='sC3r2'></fieldset></dl></div>
                • 本文介紹了檢查 MySQL 中日期范圍的重疊的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  此表用于存儲會話(事件):

                  This table is used to store sessions (events):

                  CREATE TABLE session (
                    id int(11) NOT NULL AUTO_INCREMENT
                  , start_date date
                  , end_date date
                  );
                  
                  INSERT INTO session
                    (start_date, end_date)
                  VALUES
                    ("2010-01-01", "2010-01-10")
                  , ("2010-01-20", "2010-01-30")
                  , ("2010-02-01", "2010-02-15")
                  ;
                  

                  我們不想在范圍之間發生沖突.
                  假設我們需要插入一個從 2010-01-052010-01-25 的新會話.
                  我們想知道沖突的會話.

                  We don't want to have conflict between ranges.
                  Let's say we need to insert a new session from 2010-01-05 to 2010-01-25.
                  We would like to know the conflicting session(s).

                  這是我的查詢:

                  SELECT *
                  FROM session
                  WHERE "2010-01-05" BETWEEN start_date AND end_date
                     OR "2010-01-25" BETWEEN start_date AND end_date
                     OR "2010-01-05" >= start_date AND "2010-01-25" <= end_date
                  ;
                  

                  結果如下:

                  +----+------------+------------+
                  | id | start_date | end_date   |
                  +----+------------+------------+
                  |  1 | 2010-01-01 | 2010-01-10 |
                  |  2 | 2010-01-20 | 2010-01-30 |
                  +----+------------+------------+
                  

                  有沒有更好的方法來獲得它?

                  Is there a better way to get that?

                  小提琴

                  推薦答案

                  我曾經在一個日歷應用程序中遇到過這樣的問題.我想我使用了這樣的東西:

                  I had such a query with a calendar application I once wrote. I think I used something like this:

                  ... WHERE new_start < existing_end
                        AND new_end   > existing_start;
                  

                  UPDATE 這絕對有效((ns, ne, es, ee) = (new_start, new_end, existing_start, existing_end)):

                  UPDATE This should definitely work ((ns, ne, es, ee) = (new_start, new_end, existing_start, existing_end)):

                  1. ns - ne - es - ee:不重疊且不匹配(因為 ne
                  2. ns - es - ne - ee:重疊和匹配
                  3. es - ns - ee - ne:重疊和匹配
                  4. es - ee - ns - ne:不重疊且不匹配(因為 ns > ee)
                  5. es - ns - ne - ee:重疊和匹配
                  6. ns - es - ee - ne:重疊和匹配

                  <小時>

                  這是一個小提琴

                  這篇關于檢查 MySQL 中日期范圍的重疊的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)
                    1. <small id='2rDxP'></small><noframes id='2rDxP'>

                        <bdo id='2rDxP'></bdo><ul id='2rDxP'></ul>
                        <legend id='2rDxP'><style id='2rDxP'><dir id='2rDxP'><q id='2rDxP'></q></dir></style></legend>

                          <tbody id='2rDxP'></tbody>
                        <tfoot id='2rDxP'></tfoot>
                            <i id='2rDxP'><tr id='2rDxP'><dt id='2rDxP'><q id='2rDxP'><span id='2rDxP'><b id='2rDxP'><form id='2rDxP'><ins id='2rDxP'></ins><ul id='2rDxP'></ul><sub id='2rDxP'></sub></form><legend id='2rDxP'></legend><bdo id='2rDxP'><pre id='2rDxP'><center id='2rDxP'></center></pre></bdo></b><th id='2rDxP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2rDxP'><tfoot id='2rDxP'></tfoot><dl id='2rDxP'><fieldset id='2rDxP'></fieldset></dl></div>
                          1. 主站蜘蛛池模板: 久久天天 | 久久久精品视频一区二区三区 | 毛片免费看 | 色欧美综合| 国产精品久久久久无码av | 九九色九九 | 国产精品欧美一区二区三区 | 久久精品国产免费看久久精品 | 国产高清视频在线观看 | 欧美情趣视频 | 日韩一级精品视频在线观看 | 日韩一区二区福利视频 | 玖玖玖在线观看 | 中文字幕一区二区三区四区五区 | 日日夜夜天天干 | 91精品国产一区二区三区动漫 | 日日骚网 | 亚洲精品第一 | 中文字幕观看 | 成人免费视频一区二区 | 成人免费毛片在线观看 | 国产精品视频在线观看 | 一区二区三区四区日韩 | 国产免费拔擦拔擦8x高清 | 欧美日韩亚洲一区 | 91天堂 | 国家一级黄色片 | 日韩视频精品在线 | 国产成人一区二区三区久久久 | 欧美日韩淫片 | 国产成人免费视频网站高清观看视频 | 成人免费大片黄在线播放 | 国产精品电影网 | 精品一区二区在线观看 | 日韩免费福利视频 | 精品国产91亚洲一区二区三区www | 天堂在线1| 91精品国产综合久久精品图片 | 特级黄一级播放 | 日本成人一区二区 | av国产精品毛片一区二区小说 |