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

    <bdo id='90ctp'></bdo><ul id='90ctp'></ul>

<small id='90ctp'></small><noframes id='90ctp'>

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

      1. <legend id='90ctp'><style id='90ctp'><dir id='90ctp'><q id='90ctp'></q></dir></style></legend>

        如何在 SQL 中使用 NOT EXISTS 和 COMPOSITE KEYS 從 POJ

        How to use NOT EXISTS with COMPOSITE KEYS in SQL for inserting data from POJO(如何在 SQL 中使用 NOT EXISTS 和 COMPOSITE KEYS 從 POJO 插入數據)
        1. <small id='WKgE2'></small><noframes id='WKgE2'>

              <bdo id='WKgE2'></bdo><ul id='WKgE2'></ul>
              • <tfoot id='WKgE2'></tfoot>
                <legend id='WKgE2'><style id='WKgE2'><dir id='WKgE2'><q id='WKgE2'></q></dir></style></legend>
                <i id='WKgE2'><tr id='WKgE2'><dt id='WKgE2'><q id='WKgE2'><span id='WKgE2'><b id='WKgE2'><form id='WKgE2'><ins id='WKgE2'></ins><ul id='WKgE2'></ul><sub id='WKgE2'></sub></form><legend id='WKgE2'></legend><bdo id='WKgE2'><pre id='WKgE2'><center id='WKgE2'></center></pre></bdo></b><th id='WKgE2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WKgE2'><tfoot id='WKgE2'></tfoot><dl id='WKgE2'><fieldset id='WKgE2'></fieldset></dl></div>
                  <tbody id='WKgE2'></tbody>
                  本文介紹了如何在 SQL 中使用 NOT EXISTS 和 COMPOSITE KEYS 從 POJO 插入數據的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在使用 DB2 DBMS.

                  I am using DB2 DBMS.

                  場景 1:

                  myTable 有一個復合鍵 (key1, key2),其中 key1 和 key2 都是 yourTable 的外鍵.

                  myTable has a composite key (key1, key2) where both key1 and key2 are foreign keys from yourTable.

                  我想將 yourTable 中的新數據插入 myTable,但前提是 myTable 中不存在 key1、key2 組合.

                  I want to insert new data from yourTable into myTable, but only if the key1, key2 combination does not already exist in myTable.

                  insert into myTable(key1, key2, someData)
                  values(x, y, z)
                  where NOT EXISTS (want to check if composite key is not already present)
                  

                  場景 2:

                  我將數據從 yourTable 放入一個帶有 data1、data2 和 data 屬性的 java 對象中.

                  I put data into a java object from yourTable with properties data1, data2, and data.

                  我想插入上面的數據與場景1中的檢查一樣.data1 + data2 不應已存在于 myTable 中.

                  I want to insert the above data with the check as in Scenario1. data1 + data2 should not already be present in myTable.

                  我如何實現這一目標?我認為我們不能在插入語句中使用 SELECT 語句.

                  How do I achieve this? I don't think we can use a SELECT statement inside the insert statement.

                  insert into myTable(key1, key2, data)
                  values(data1, data2, data)
                  where (data1 + data2 are already not present in myTable)
                  

                  我怎樣才能做到這一點?

                  How can I achieve this?

                  推薦答案

                  insert into mytable(...)
                  select ...
                  from yourtable y
                  left join mytable m
                  on y.key1 = m.key1 and y.key2 = m.key2
                  where m.key is null
                  

                  insert into mytable(...)
                  select ...
                  from yourtable y
                  where not exists (select 1 from mytable m where y.key1 = m.key1 and y.key2 = m.key2)
                  

                  對于您的第二種情況,它看起來類似于上面的查詢

                  for your 2nd scenario, it'd look similar to the above query

                  insert into mytable(...)
                  select ...
                  where not exists (select 1 from mytable m where javakey1 = m.key1 and javakey2 = m.key2)
                  

                  這篇關于如何在 SQL 中使用 NOT EXISTS 和 COMPOSITE KEYS 從 POJO 插入數據的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)

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

                    • <tfoot id='O0AhV'></tfoot>

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

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

                            <bdo id='O0AhV'></bdo><ul id='O0AhV'></ul>
                              <tbody id='O0AhV'></tbody>
                            主站蜘蛛池模板: 在线观看视频中文字幕 | 中文字幕视频一区二区 | 日本在线视频中文字幕 | 特级特黄特色的免费大片 | 岛国二区| 中文字幕 国产精品 | 成人欧美一区二区三区在线播放 | 亚洲综合婷婷 | 国产精品久久久久无码av | 特一级黄色毛片 | 成人av高清在线观看 | 日本网站在线看 | 久久午夜电影 | 一区在线视频 | 一区中文字幕 | 在线免费观看视频你懂的 | 欧美小视频在线观看 | 国产精品免费观看 | 亚洲欧美日韩久久久 | 国产精品久久av | 毛片免费在线观看 | 久久久久av| 日韩视频一区二区 | 欧美一区二| 天天射天天干 | 一级大片免费 | 亚洲综合视频一区 | 国户精品久久久久久久久久久不卡 | 欧美极品在线 | 亚洲欧美国产精品久久 | 99在线精品视频 | 国产精品中文字幕在线 | 欧美一级二级在线观看 | 亚洲综合大片69999 | 国产精品久久久久久久免费观看 | 欧美国产中文字幕 | 日韩一二区 | 黑人精品xxx一区一二区 | 中文字幕日韩欧美 | 一级黄色片在线看 | 欧洲精品视频一区 |