sql语句,执行,实现没有这条数据就新增,如有这条数据就修改

    sql语句,执行,实现没有这条数据就新增,如有这条数据就修改

    方法一:insert into on duplicate key update

     举个例子,字段a被定义为UNIQUE,并且原数据库表table中已存在记录(2,2,9)和(3,2,1),如果插入记录的a值与原有记录重复,则更新原有记录,否则插入新行:






    INSERT  INTO  TABLE  (a ,b ,c )  VALUES 
    ( 1 , 2 , 3 ) ,
    ( 2 , 5 , 7 ) ,
    ( 3 , 3 , 6 ) ,
    ( 4 , 8 , 2 )
    ON DUPLICATE  KEY  UPDATE b = VALUES (b );

         以上SQL语句的执行,发现(2,5,7)中的a与原有记录(2,2,9)发生唯一值冲突,则执行ON DUPLICATE KEY UPDATE,将原有记录(2,2,9)更新成(2,5,9),将(3,2,1)更新成(3,3,1),插入新记录(1,2,3)和(4,8,2)

    方法二:创建存储过程

       create procedure name()

    if exists( select  from  表  where  ID = @ID)
    begin
        update  表  set  XX= XX  where  ID = @ID
    end
    else
    begin
        insert  表  values (XX...) 
    end

            <div class="recommend-box"><div class="recommend-item-box type_blog clearfix" data-report-click="{&quot;mod&quot;:&quot;popu_387&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/qq_36124520/article/details/80019444&quot;,&quot;strategy&quot;:&quot;BlogCommendFromMachineLearnPai2&quot;,&quot;index&quot;:&quot;0&quot;}">
    <div class="content" style="width: 712px;">
    	<a href="https://blog.csdn.net/qq_36124520/article/details/80019444" target="_blank" rel="noopener" title="判断sql中是否存在某个数据,不存在就添加数据">
    	<h4 class="text-truncate oneline" style="width: 552px;">
    			判断<em>sql</em>中是否存在某个<em>数据</em>,不存在就<em>添加</em><em>数据</em>		</h4>
    	<div class="info-box d-flex align-content-center">
    		<p class="date-and-readNum oneline">
    			<span class="date hover-show">04-20</span>
    			<span class="read-num hover-hide">
    				阅读数 
    				1万+</span>
    			</p>
    		</div>
    	</a>
    	<p class="content" style="width: 712px;">
    		<a href="https://blog.csdn.net/qq_36124520/article/details/80019444" target="_blank" rel="noopener" title="判断sql中是否存在某个数据,不存在就添加数据">
    			<span class="desc oneline">USEOperAllowDBIFNOTEXISTS(SELECT*FROMOperAllowDB.dbo.TCustomConfigWHEREConfigCode='1007')BEGININSERT...</span>
    		</a>
    		<span class="blog_title_box oneline ">
    								<span class="type-show type-show-blog type-show-after">博文</span>
    										<a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_36124520">来自:	<span class="blog_title"> qq_36124520的博客</span></a>
    											</span>
    	</p>
    </div>
    </div>
    
    <div class="comment-edit-box d-flex">
    	<a id="commentsedit"></a>
    	<div class="user-img">
    		<a href="//me.csdn.net/weixin_42447342" target="_blank" rel="noopener">
    			<img class="" src="https://avatar.csdn.net/6/D/7/3_weixin_42447342.jpg">
    		</a>
    	</div>
    	<form id="commentform">
    		<input type="hidden" id="comment_replyId">
    		<textarea class="comment-content" name="comment_content" id="comment_content" placeholder="想对作者说点什么"></textarea>
    		<div class="opt-box"> <!-- d-flex -->
    			<div id="ubbtools" class="add_code">
    				<a href="#insertcode" code="code" target="_self"><i class="icon iconfont icon-daima"></i></a>
    			</div>
    			<input type="hidden" id="comment_replyId" name="comment_replyId">
    			<input type="hidden" id="article_id" name="article_id" value="51791023">
    			<input type="hidden" id="comment_userId" name="comment_userId" value="">
    			<input type="hidden" id="commentId" name="commentId" value="">
    			<div style="display: none;" class="csdn-tracking-statistics tracking-click" data-report-click="{&quot;mod&quot;:&quot;popu_384&quot;,&quot;dest&quot;:&quot;&quot;}"><a href="#" target="_blank" class="comment_area_btn" rel="noopener">发表评论</a></div>
    			<div class="dropdown" id="myDrap">
    				<a class="dropdown-face d-flex align-items-center" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
    				<div class="txt-selected text-truncate">添加代码片</div>
    				<svg class="icon d-block" aria-hidden="true">
    					<use xlink:href="#csdnc-triangledown"></use>
    				</svg>
    				</a>
    				<ul class="dropdown-menu" id="commentCode" aria-labelledby="drop4">
    					<li><a data-code="html">HTML/XML</a></li>
    					<li><a data-code="objc">objective-c</a></li>
    					<li><a data-code="ruby">Ruby</a></li>
    					<li><a data-code="php">PHP</a></li>
    					<li><a data-code="csharp">C</a></li>
    					<li><a data-code="cpp">C++</a></li>
    					<li><a data-code="javascript">JavaScript</a></li>
    					<li><a data-code="python">Python</a></li>
    					<li><a data-code="java">Java</a></li>
    					<li><a data-code="css">CSS</a></li>
    					<li><a data-code="sql">SQL</a></li>
    					<li><a data-code="plain">其它</a></li>
    				</ul>
    			</div>  
    			<div class="right-box">
    				<span id="tip_comment" class="tip">还能输入<em>1000</em>个字符</span>
    				<input type="button" class="btn btn-sm btn-cancel d-none" value="取消回复">
    				<input type="submit" class="btn btn-sm btn-red btn-comment" value="发表评论">
    			</div>
    		</div>
    	</form>
    </div>
    
    	<div class="comment-list-container">
    	<a id="comments"></a>
    	<div class="comment-list-box" style="max-height: none;"><ul class="comment-list"><li class="comment-line-box d-flex" data-commentid="8880832" data-replyname="u014355937">        <a target="_blank" href="https://me.csdn.net/u014355937"><img src="https://avatar.csdn.net/9/C/6/3_u014355937.jpg" alt="u014355937" class="avatar"></a>          <div class="right-box ">            <div class="info-box">              <a target="_blank" href="https://me.csdn.net/u014355937"><span class="name ">起嘛名啊:</span></a>              <span class="comment">将原有记录(2,2,9)更新成(2,5,9),将(3,2,1)更新成(3,3,1)
    

    写的有问题吧?应该是:
    将原有记录(2,2,9)更新成(2,5,7),将(3,2,1)更新成(3,3,6)吧?(9个月前#1楼)查看回复(2)举报回复


      • 上一页
      • 1
      • 下一页

      </div>
      
      <div class="recommend-item-box recommend-recommend-box"><div class="content" style="width: 712px;"><link rel="stylesheet" href="https://www.csdn.net/company/css/edu-recommend-1.0.1.css"><div class="edu-ad-list"><div class="recommend-item-box type_blog clearfix"><div class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=cLSLQQHtcDpESySiHJipciQinLSEmvApHAiSvotAHLSnAtpitiSSDiApXbnEnUippHQWcyLbbLnUUJcEiyfbXiSHcSLJtLSAQtSQ&amp;k=&amp;dest=https%3A%2F%2Fedu.csdn.net%2Ftopic%2Fai30%3Futm_source%3Dblogfeed5&amp;adBlockFlag=1" target="_blank" title="羡慕AI高薪岗!为什么这类程序员不建议大家转型?"><h4 class="text-truncate oneline" style="width: 662px;">羡慕AI高薪岗!为什么这类程序员不建议大家转型?</h4></a><p class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=cLSLQQHtcDpESySiHJipciQinLSEmvApHAiSvotAHLSnAtpitiSSDiApXbnEnUippHQWcyLbbLnUUJcEiyfbXiSHcSLJtLSAQtSQ&amp;k=&amp;dest=https%3A%2F%2Fedu.csdn.net%2Ftopic%2Fai30%3Futm_source%3Dblogfeed5&amp;adBlockFlag=1" target="_blank" title="羡慕AI高薪岗!为什么这类程序员不建议大家转型?"><span class="desc oneline">被众多开发工程师羡慕的AI程序员为啥这么高薪!30w只是白菜价有啥要求?</span></a><span class="blog_title_box oneline "><span class="type-show type-show-edu type-show-after">学院</span>讲师:<span class="blog_title">CSDN</span></span></p></div></div></div><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=cLSLQQHtcDpESySiHJipciQinLSEmvApHAiSvotAHLSnAtpitiSSDiApXbnEnUippHQWcyLbbLnUUJcEiyfbXiSHcSLJtLSAQtSQ&amp;adBlockFlag=1"></div></div>
      

      求一SQL语句 存在就修改,不存在就写入

      08-30

      想写一个价格表。。 有数据 A ,B,C 分别对应SQL表里的 产品,客户,价格。 当录入A,B,C 的时候 就判断。。 如果 SQL里 已经有A,B数据, 就将SQL里对应的 产品,和客户的价格修改 论坛

      查询一条数据,如果有就进行更改,没有就进行添加

      07-13

      web开发在后台查询一条数据,如果有就进行更改,没有就进行添加,如果多个用户在同一时间进行同样的操作就可能会 添加多条数据,怎么避免,,求大神解答 论坛

      <div class="recommend-item-box recommend-recommend-box"><div class="content" style="width: 712px;"><link rel="stylesheet" href="https://www.csdn.net/company/css/edu-recommend-1.0.1.css"><div class="edu-ad-list"><div class="recommend-item-box type_blog clearfix"><div class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=tAEcnQAipbQLpLSJHbJSbSicAtADEyHSJcLQEJSEtmUSiHSXQAiHDptiXbiScHQAAWcEtQiDtvEtiicQDbiESEiXpHLStEpAcbQQ&amp;k=&amp;dest=https%3A%2F%2Fedu.csdn.net%2Ftopic%2Fai30%3Futm_source%3Dblogfeed3&amp;adBlockFlag=1" target="_blank" title="腾讯AI击败王者荣耀职业队,1天训练达440年,网友:想哭!"><h4 class="text-truncate oneline" style="width: 662px;">腾讯AI击败王者荣耀职业队,1天训练达440年,网友:想哭!</h4></a><p class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=tAEcnQAipbQLpLSJHbJSbSicAtADEyHSJcLQEJSEtmUSiHSXQAiHDptiXbiScHQAAWcEtQiDtvEtiicQDbiESEiXpHLStEpAcbQQ&amp;k=&amp;dest=https%3A%2F%2Fedu.csdn.net%2Ftopic%2Fai30%3Futm_source%3Dblogfeed3&amp;adBlockFlag=1" target="_blank" title="腾讯AI击败王者荣耀职业队,1天训练达440年,网友:想哭!"><span class="desc oneline">腾讯AI绝悟的能力,已经精进到王者荣耀电竞职业水平,AI应用空间究竟有多大!</span></a><span class="blog_title_box oneline "><span class="type-show type-show-edu type-show-after">学院</span>讲师:<span class="blog_title">CSDN</span></span></p></div></div></div><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=tAEcnQAipbQLpLSJHbJSbSicAtADEyHSJcLQEJSEtmUSiHSXQAiHDptiXbiScHQAAWcEtQiDtvEtiicQDbiESEiXpHLStEpAcbQQ&amp;adBlockFlag=1"></div></div>
      

      sql 如果查不到数据怎么显示一条为null的记录显示为指定记录?

      10-10

      比如 日期 地区 库存 2018-10-01 北京 有 2018-10-01 上海 有 2018-10-02 北京 有 2018-10-02 上海 无 这个表 我如果查询的时候指定 where 日期 论坛

      		<div class="recommend-item-box blog-expert-recommend-box" style="display: block;">
      		<div class="d-flex">
      			<div class="blog-expert-recommend">
      				<div class="blog-expert">
      					<div class="blog-expert-flexbox" data-report-view="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><a href="https://blog.csdn.net/qq_36124520" target="_blank"><img src="https://avatar.csdn.net/0/A/9/3_qq_36124520.jpg" alt="丶低调丶丶" title="丶低调丶丶"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="qq_36124520" data-nick="丶低调丶丶">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><a href="https://blog.csdn.net/qq_36124520" target="_blank"><h5 class="oneline" title="丶低调丶丶">丶低调丶丶</h5></a></span>  <p></p><p class="article-num" title="20篇文章"> 20篇文章</p><p class="article-num" title="排名:千里之外"> 排名:千里之外</p><p></p></div></div></div><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><a href="https://blog.csdn.net/lfy609225258" target="_blank"><img src="https://avatar.csdn.net/6/D/D/3_lfy609225258.jpg" alt="Beautiful菜园子" title="Beautiful菜园子"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="lfy609225258" data-nick="Beautiful菜园子">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><a href="https://blog.csdn.net/lfy609225258" target="_blank"><h5 class="oneline" title="Beautiful菜园子">Beautiful菜园子</h5></a></span>  <p></p><p class="article-num" title="22篇文章"> 22篇文章</p><p class="article-num" title="排名:千里之外"> 排名:千里之外</p><p></p></div></div></div><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><a href="https://blog.csdn.net/laiyijian" target="_blank"><img src="https://avatar.csdn.net/7/B/6/3_laiyijian.jpg" alt="laiyijian" title="laiyijian"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="laiyijian" data-nick="laiyijian">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><a href="https://blog.csdn.net/laiyijian" target="_blank"><h5 class="oneline" title="laiyijian">laiyijian</h5></a></span>  <p></p><p class="article-num" title="98篇文章"> 98篇文章</p><p class="article-num" title="排名:千里之外"> 排名:千里之外</p><p></p></div></div></div><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><a href="https://blog.csdn.net/wangzl1163" target="_blank"><img src="https://avatar.csdn.net/E/A/6/3_wangzl1163.jpg" alt="代码养家" title="代码养家"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="wangzl1163" data-nick="代码养家">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/u013176201/article/details/51791023&quot;}"><a href="https://blog.csdn.net/wangzl1163" target="_blank"><h5 class="oneline" title="代码养家">代码养家</h5></a></span>  <p></p><p class="article-num" title="204篇文章"> 204篇文章</p><p class="article-num" title="排名:4000+"> 排名:4000+</p><p></p></div></div></div></div>
      				</div>
      			</div>
      		</div>
      	</div>
      
      <div class="recommend-item-box recommend-recommend-box"><div class="content" style="width: 712px;"><link rel="stylesheet" href="https://www.csdn.net/company/css/edu-recommend-1.0.1.css"><div class="edu-ad-list"><div class="recommend-item-box type_blog clearfix"><div class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=cQvHtctnicbiiiAySHSpAAiAJJAiEcDSDcAHnbnnXcLiSpnJHpvyJtvLpAnAHASQEWAiSAEAtJiSQXiQcUpAXJcDHSitcEEQpppQ&amp;k=&amp;dest=https%3A%2F%2Fmall.csdn.net%2Fv2%2F%23%2Fproduct%2F1586&amp;adBlockFlag=1" target="_blank" title="一本可陪伴一辈子的笔记本"><h4 class="text-truncate oneline" style="width: 662px;">一本可陪伴一辈子的笔记本</h4></a><p class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=cQvHtctnicbiiiAySHSpAAiAJJAiEcDSDcAHnbnnXcLiSpnJHpvyJtvLpAnAHASQEWAiSAEAtJiSQXiQcUpAXJcDHSitcEEQpppQ&amp;k=&amp;dest=https%3A%2F%2Fmall.csdn.net%2Fv2%2F%23%2Fproduct%2F1586&amp;adBlockFlag=1" target="_blank" title="一本可陪伴一辈子的笔记本"><span class="desc oneline">可擦可写,可循环利用,支持OCR识别,让你的笔记本变得智能</span></a><span class="blog_title_box oneline "><span class="type-show type-show-edu type-show-after">学院</span>讲师:<span class="blog_title">CSDN</span></span></p></div></div></div><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=cQvHtctnicbiiiAySHSpAAiAJJAiEcDSDcAHnbnnXcLiSpnJHpvyJtvLpAnAHASQEWAiSAEAtJiSQXiQcUpAXJcDHSitcEEQpppQ&amp;adBlockFlag=1"></div></div>
      

      往list里面添加数据,如果该数据已存在,不添加,次数加1

      09-01

      自己定义了一个list<twoparameter>,twoparameter已经另外做了处理 p1代表一个数据 p2代表次数 list.add(); 如果p1已经存在不插入,p2+1 这边的处理如何弄 论坛

      <div class="recommend-item-box recommend-recommend-box"><div class="content" style="width: 712px;"><link rel="stylesheet" href="https://www.csdn.net/company/css/edu-recommend-1.0.1.css"><div class="edu-ad-list"><div class="recommend-item-box type_blog clearfix"><div class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=AALbLpcQQHncAittSELiLDAiyLEtALiHnEcbpEQmXHAJEbXSJDpHADpnSAXifHQtSLAJbibWJQctAtbEAfDiLXtDnfnAAHnAcQLQ&amp;k=&amp;dest=https%3A%2F%2Fedu.csdn.net%2Ftopic%2Fai30%3Futm_source%3Dblogfeed6&amp;adBlockFlag=1" target="_blank" title="AI学习路线,考虑转型/跳槽程序员免费领取,自测专业程度!"><h4 class="text-truncate oneline" style="width: 662px;">AI学习路线,考虑转型/跳槽程序员免费领取,自测专业程度!</h4></a><p class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=AALbLpcQQHncAittSELiLDAiyLEtALiHnEcbpEQmXHAJEbXSJDpHADpnSAXifHQtSLAJbibWJQctAtbEAfDiLXtDnfnAAHnAcQLQ&amp;k=&amp;dest=https%3A%2F%2Fedu.csdn.net%2Ftopic%2Fai30%3Futm_source%3Dblogfeed6&amp;adBlockFlag=1" target="_blank" title="AI学习路线,考虑转型/跳槽程序员免费领取,自测专业程度!"><span class="desc oneline">如何能够短时间内抓住技术重点,打造属于自己的“offer收割机”?</span></a><span class="blog_title_box oneline "><span class="type-show type-show-edu type-show-after">学院</span>讲师:<span class="blog_title">CSDN</span></span></p></div></div></div><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=AALbLpcQQHncAittSELiLDAiyLEtALiHnEcbpEQmXHAJEbXSJDpHADpnSAXifHQtSLAJbibWJQctAtbEAfDiLXtDnfnAAHnAcQLQ&amp;adBlockFlag=1"></div></div>
      

      SQL如何实现存在即更新,没有就插入

      07-23

      以前一直在用mysql,由于项目原因需要用SQL SERVER,今天遇到个问题就是SQL如何实现存在即更新,没有就插入。 我用mybatis写的:意思是就是判断category和position同时存 论坛

      新人求教mysql里边用update修改没有数据也会执行成功

      08-30

      学习写代码的时候发现修改数据的时候如果mysql里边没有的 用update修改的会也会返回执行成功 这个时候该怎么办 要先用sql查询判断数据是否存在吗? 论坛

      <div class="recommend-item-box recommend-recommend-box"><div class="content" style="width: 712px;"><link rel="stylesheet" href="https://www.csdn.net/company/css/edu-recommend-1.0.1.css"><div class="edu-ad-list"><div class="recommend-item-box type_blog clearfix"><div class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=cnSbQtQHAipnibpcDLnyttHcQLtntJpASmfEEHEbJbSXUpptHbtDLpXDSJbHpQLppWQibSJXDiXntofJbtUtoJiibJibpHcQntiQ&amp;k=&amp;dest=https%3A%2F%2Fedu.csdn.net%2Ftopic%2Fai30%3Futm_source%3Dblogfeed4&amp;adBlockFlag=1" target="_blank" title="拿下阿里offer的AI应届生,需要具备什么样的能力?"><h4 class="text-truncate oneline" style="width: 662px;">拿下阿里offer的AI应届生,需要具备什么样的能力?</h4></a><p class="content" style="width: 712px;"><a href="https://kunyu.csdn.net?d=2&amp;m=cnSbQtQHAipnibpcDLnyttHcQLtntJpASmfEEHEbJbSXUpptHbtDLpXDSJbHpQLppWQibSJXDiXntofJbtUtoJiibJibpHcQntiQ&amp;k=&amp;dest=https%3A%2F%2Fedu.csdn.net%2Ftopic%2Fai30%3Futm_source%3Dblogfeed4&amp;adBlockFlag=1" target="_blank" title="拿下阿里offer的AI应届生,需要具备什么样的能力?"><span class="desc oneline">人工智能的火广大程序员应该都有了解,但是进军AI领域的条件是?</span></a><span class="blog_title_box oneline "><span class="type-show type-show-edu type-show-after">学院</span>讲师:<span class="blog_title">CSDN</span></span></p></div></div></div><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=cnSbQtQHAipnibpcDLnyttHcQLtntJpASmfEEHEbJbSXUpptHbtDLpXDSJbHpQLppWQibSJXDiXntofJbtUtoJiibJibpHcQntiQ&amp;adBlockFlag=1"></div></div>
      
      <div class="recommend-item-box recommend-recommend-box"><div id="kp_box_64" data-pid="64" data-report-view="{&quot;mod&quot;:&quot;kp_popu_64-809&quot;,&quot;keyword&quot;:&quot;&quot;}" data-report-click="{&quot;mod&quot;:&quot;kp_popu_64-809&quot;,&quot;keyword&quot;:&quot;&quot;}"><script async="async" charset="utf-8" src="https://shared.ydstatic.com/js/yatdk/3.0.1/stream.js" data-id="6cb24153a03289ff3597c7aab4b69fe9" data-div-style="width:100%;" data-tit-style="margin-bottom: 6px; font-size: 18px; line-height: 24px; color: #3d3d3d;display: inline-block;font-weight:bold;" data-des-style="font-size: 13px; line-height: 22px; white-space: normal; color: #999;" data-img-style="float:left;margin-right:15px;width:90px;height:60px;" data-is-handling="1">
      

      有则修改,无则添加

      05-29 阅读数 368

      博文 来自: 精哥哥 www.fuzhijing.com

      根据mysql表中数据的存在与否,一条语句进行修改以及新增

      05-03 阅读数 1782

      INSERTINTO`account_cash_rlt`VALUES('6','7','666','888')ONDUPLICATEKEYUPDATEuser_id='88',ROBOT_NUM=66... 博文 来自: 张肖的博客

      <div class="recommend-item-box recommend-recommend-box"><div id="kp_box_65" data-pid="65" data-report-view="{&quot;mod&quot;:&quot;kp_popu_65-809&quot;,&quot;keyword&quot;:&quot;&quot;}" data-report-click="{&quot;mod&quot;:&quot;kp_popu_65-809&quot;,&quot;keyword&quot;:&quot;&quot;}"><script async="async" charset="utf-8" src="https://shared.ydstatic.com/js/yatdk/3.0.1/stream.js" data-id="6cb24153a03289ff3597c7aab4b69fe9" data-div-style="width:100%;" data-tit-style="margin-bottom: 6px; font-size: 18px; line-height: 24px; color: #3d3d3d;display: inline-block;font-weight:bold;" data-des-style="font-size: 13px; line-height: 22px; white-space: normal; color: #999;" data-img-style="float:left;margin-right:15px;width:90px;height:60px;" data-is-handling="1">
      

      SQL语句实现两张表之间不存在则插入,存在则更新

      12-14 阅读数 3068

      ifnotexists(selectcolumnname1,columnname2fromtablename1)insertintotablename1(columnname1,columnname2... 博文 来自: qq_33378746的博客

      oracle表中存在数据修改,没有数据自动添加sql语句

      07-27 阅读数 1465

      mergeintotablet1using(select'123'ID,'aa'Namefromdual)t2on(t1.ID=t2.ID)whenmatchedthenupdatesett1.Nam... 博文 来自: lipromising的博客

      <div class="recommend-item-box recommend-recommend-box"><div id="kp_box_66" data-pid="66" data-report-view="{&quot;mod&quot;:&quot;kp_popu_66-808&quot;,&quot;keyword&quot;:&quot;&quot;}" data-report-click="{&quot;mod&quot;:&quot;kp_popu_66-808&quot;,&quot;keyword&quot;:&quot;&quot;}"><script async="async" charset="utf-8" src="https://shared.ydstatic.com/js/yatdk/3.0.1/stream.js" data-id="8935aa488dd58452b9e5ee3b44f1212f" data-div-style="width:100%;" data-tit-style="margin-bottom: 6px; font-size: 18px; line-height: 24px; color: #3d3d3d;display: inline-block;font-weight:bold;" data-des-style="font-size: 13px; line-height: 22px; white-space: normal; color: #999;" data-img-style="float:left;margin-right:15px;width:90px;height:60px;" data-is-handling="1">
      

                  <div class="recommend-item-box type_hot_word">
                                  <div class="content clearfix" style="width: 712px;">
                      <div class="float-left">
                                          <span>
                          <a href="https://www.csdn.net/gather_11/MtjaQgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c# 去空格去转义符</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_18/MtjaUgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c#用户登录窗体代码</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_14/MtjaYgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c# 流</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_10/MtjacgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c# linux 可视化</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_13/MtjaggtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c# mvc 返回图片</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_16/MtjakgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c# 像素空间</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_13/MtzaAgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c# 日期 最后一天</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_1c/MtzaEgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c#字典序排序</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_16/MtzaIgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c# 截屏取色</a>
                      </span>
                                          <span>
                          <a href="https://www.csdn.net/gather_11/MtzaMgtsZG93bmxvYWQO0O0O.html" target="_blank">
                          c#中的哪些属于托管机制</a>
                      </span>
                                          </div>
                  </div>
                                  </div>
                              <div class="recommend-loading-box">
                  <img src="https://csdnimg.cn/release/phoenix/images/feedLoading.gif">
              </div>
              <div class="recommend-end-box">
                  <p class="text-center">没有更多推荐了,<a href="https://blog.csdn.net/" class="c-blue c-blue-hover c-blue-focus">返回首页</a></p>
              </div>
          </div>
      </main>
      
      <aside>
      <div id="asideProfile" class="aside-box">
      <!-- <h3 class="aside-title">个人资料</h3> -->
      <div class="profile-intro d-flex">
          <div class="avatar-box d-flex justify-content-center flex-column">
              <a href="https://blog.csdn.net/u013176201">
                <img src="https://avatar.csdn.net/2/6/3/3_u013176201.jpg" class="avatar_pic" username="u013176201">
                                <img src="https://g.csdnimg.cn/static/user-reg-year/1x/6.png" class="user-years">
                            </a>
              
          </div>
          <div class="user-info d-flex flex-column">
              <p class="name csdn-tracking-statistics tracking-click" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" username="u013176201">
                  <a href="https://blog.csdn.net/u013176201" class="" id="uid" title="小茶杯里的程序猿">小茶杯里的程序猿</a>
              </p>
                                          <p class="personal-home-page" style="right:-96px;"><a target="_blank" href="https://me.csdn.net/u013176201">TA的个人主页 &gt;</a></p>
                      </div>
                  <div class="profile-personal-letter">
              <a id="profile-personal-alink" href="https://www.csdn.net/apps/download/?code=app_1564993662&amp;callback=csdnapp%3A%2F%2Fweb%3Furl%3Dhttps%3A%2F%2Fapp.csdn.net%2Fother%3Fusername%3Du013176201" target="_blank" rel="noopener">私信</a>
          </div>
          <div class="opt-box d-flex  flex-column">
              <span class="csdn-tracking-statistics tracking-click" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">
                                      <a class="btn btn-sm btn-gray-hollow attention attented" id="btnAttent" style="line-height:24px;padding:0;">已关注</a>
                              </span>
          </div>
              </div>
      <div class="data-info d-flex item-tiling">
                  <dl class="text-center" title="2">
                          <dt><a href="https://blog.csdn.net/u013176201?t=1">原创</a></dt>
              <dd><a href="https://blog.csdn.net/u013176201?t=1"><span class="count">2</span></a></dd>
                      </dl>
          <dl class="text-center" id="fanBox" title="1">
              <dt>粉丝</dt>
              <dd><span class="count" id="fan">1</span></dd>
          </dl>
          <dl class="text-center" title="1">
              <dt>喜欢</dt>
              <dd><span class="count">1</span></dd>
          </dl>
          <dl class="text-center" title="3">
              <dt>评论</dt>
              <dd><span class="count">3</span></dd>
          </dl>
      </div>
      <div class="grade-box clearfix">
          <dl>
              <dt>等级:</dt>
              <dd>
                  <a href="https://blog.csdn.net/home/help.html#level" title="1级,点击查看等级说明" target="_blank">
                      <svg class="icon icon-level" aria-hidden="true">
                          <use xlink:href="#csdnc-bloglevel-1"></use>
                      </svg>
                  </a>
              </dd>
          </dl>
          <dl>
              <dt>访问:</dt>
              <dd title="5983">
                  5983            </dd>
          </dl>
          <dl>
              <dt>积分:</dt>
              <dd title="81">
                  81            </dd>
          </dl>
          <dl title="1683314">
              <dt>排名:</dt>
              <dd>168万+</dd>
          </dl>
      </div>
      </div>
      

      分类专栏

      热门文章

      • 				<a href="https://blog.csdn.net/u013176201/article/details/51791023">
                                                    SQL实现没有这条数据就添加,有这条数据就修改                    </a>
        				<p class="read">阅读数 <span>5697</span></p>
        			</li>
        						<li>
        
        				<a href="https://blog.csdn.net/u013176201/article/details/51890284">
                                                    阿里云ECS服务器centos6.5安装jdk;mysql;tomcat                    </a>
        				<p class="read">阅读数 <span>309</span></p>
        			</li>
        				</ul>
        </div>
        

      最新评论

      写的有问题吧?应该是:
      将原有记录(2,2,9)更新成(2,5,7),将(3,2,1)更新成(3,3,6)吧?




      	<div class="aside-box">
      		<div id="kp_box_57" data-pid="57" data-report-view="{&quot;mod&quot;:&quot;kp_popu_57-707&quot;,&quot;keyword&quot;:&quot;&quot;}" data-report-click="{&quot;mod&quot;:&quot;kp_popu_57-707&quot;,&quot;keyword&quot;:&quot;&quot;}"><script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
      

      			<div class="aside-box">
      		<div class="persion_article">
      		<div class="right_box footer_box csdn-tracking-statistics" data-report-view="{&quot;mod&quot;:&quot;popu_475&quot;}">        <div class="contact-box" id="footer-contact-box"><div class="img-box"><img src="https://csdnimg.cn/pubfooter/images/csdn-cxrs.png" alt="程序人生" style="padding: 6px;width: 98px;height: 98px;"><p class="app-text">程序人生</p></div><div class="img-box fr"><a href="https://blog.csdn.net/csdnnews?utm_source=csdn_footer" target="_blank"><img style="padding: 6px;width: 98px;height: 98px;" src="//csdnimg.cn/pubfooter/images/csdn-zx.png" alt="CSDN资讯"></a><p class="app-text">CSDN资讯</p></div></div>        <div class="contact-info">        <p><svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M2.167 2h11.666C14.478 2 15 2.576 15 3.286v9.428c0 .71-.522 1.286-1.167 1.286H2.167C1.522 14 1 13.424 1 12.714V3.286C1 2.576 1.522 2 2.167 2zm-.164 3v1L8 10l6-4V5L8 9 2.003 5z" fill="#5c5c5c" fill-rule="evenodd"></path></svg><a href="mailto:webmaster@csdn.net" target="_blank"><span class="txt">kefu@csdn.net</span></a>        <em class="width126"><svg t="1538013544186" width="17" height="17" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23556" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M902.60033922 650.96445566c-18.0718526-100.84369837-94.08399771-166.87723736-94.08399771-166.87723737 10.87530062-91.53186599-28.94715402-107.78733693-28.94715401-107.78733691C771.20003413 93.08221664 517.34798062 98.02553561 511.98620441 98.16348824 506.65661791 98.02553561 252.75857992 93.08221664 244.43541101 376.29988138c0 0-39.79946279 16.25547094-28.947154 107.78733691 0 0-75.98915247 66.03353901-94.0839977 166.87723737 0 0-9.63372291 170.35365477 86.84146124 20.85850523 0 0 21.70461757 56.79068296 61.50407954 107.78733692 0 0-71.1607951 23.19910867-65.11385185 83.46161052 0 0-2.43717093 67.16015592 151.93232126 62.56172014 0 0 108.5460788-8.0932473 141.10300432-52.14626271H526.33792324c32.57991817 44.05301539 141.10300431 52.1462627 141.10300431 52.14626271 154.3235077 4.59843579 151.95071457-62.56172013 151.95071457-62.56172014 6.00095876-60.26250183-65.11385185-83.46161053-65.11385185-83.46161052 39.77647014-50.99665395 61.4810877-107.78733693 61.4810877-107.78733692 96.45219231 149.49514952 86.84146124-20.85850523 86.84146125-20.85850523" p-id="23557" fill="#5c5c5c"></path></svg><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&amp;key=XzgwMDE4MDEwNl80ODc3MzVfODAwMTgwMTA2XzJf" class="qqcustomer_s" target="_blank"><span class="txt">QQ客服</span></a></em></p>        <p><em class="width126"><svg t="1538012951761" width="17" height="17" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23083" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M466.4934485 880.02006511C264.6019863 859.18313878 107.13744214 688.54706608 107.13744214 481.14947309 107.13744214 259.68965394 286.68049114 80.14660493 508.14031029 80.14660493s401.00286817 179.54304901 401.00286814 401.00286816v1.67343191C908.30646249 737.58941724 715.26799489 943.85339507 477.28978337 943.85339507c-31.71423369 0-62.61874229-3.67075386-92.38963569-10.60739903 30.09478346-11.01226158 56.84270313-29.63593923 81.5933008-53.22593095z m-205.13036267-398.87059202a246.77722444 246.77722444 0 0 0 493.5544489 0 30.85052691 30.85052691 0 0 0-61.70105383 0 185.07617062 185.07617062 0 0 1-370.15234125 0 30.85052691 30.85052691 0 0 0-61.70105382 0z" p-id="23084" fill="#5c5c5c"></path></svg><a href="http://bbs.csdn.net/forums/Service" target="_blank"><span class="txt">客服论坛</span></a></em>        <svg t="1538013874294" width="17" height="17" style="" viewBox="0 0 1194 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23784" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M1031.29689505 943.85339507h-863.70679012A71.98456279 71.98456279 0 0 1 95.60554212 871.86883228v-150.85178906c0-28.58329658 16.92325492-54.46750945 43.13135785-65.93861527l227.99160176-99.75813425c10.55341735-4.61543317 18.24580594-14.0082445 20.72896295-25.23643277l23.21211998-105.53417343a71.95757195 71.95757195 0 0 1 70.28414006-56.51881307h236.95255971c33.79252817 0 63.02360485 23.5090192 70.28414004 56.51881307l23.21211997 105.53417343c2.48315701 11.25517912 10.17554562 20.62099961 20.72896296 25.23643277l227.99160177 99.75813425a71.98456279 71.98456279 0 0 1 43.13135783 65.93861527v150.85178906A71.98456279 71.98456279 0 0 1 1031.26990421 943.85339507z m-431.85339506-143.94213475c143.94213474 0 143.94213474-48.34058941 143.94213474-107.96334876s-64.45411922-107.96334877-143.94213474-107.96334877c-79.51500637 0-143.94213474 48.34058941-143.94213475 107.96334877s0 107.96334877 143.94213475 107.96334876zM1103.254467 296.07330247v148.9894213a35.97878598 35.97878598 0 0 1-44.15700966 35.03410667l-143.94213473-33.57660146a36.0057768 36.0057768 0 0 1-27.80056231-35.03410668V296.1002933c-35.97878598-47.98970852-131.95820302-71.98456279-287.91126031-71.98456279S347.53801649 248.11058478 311.53223967 296.1002933v115.385829c0 16.73431906-11.52508749 31.25538946-27.80056233 35.03410668l-143.94213473 33.57660146A35.97878598 35.97878598 0 0 1 95.63253297 445.06272377V296.07330247C162.81272673 152.13116772 330.77670658 80.14660493 599.47049084 80.14660493s436.63077325 71.98456279 503.81096699 215.92669754z" p-id="23785" fill="#5c5c5c"></path></svg>400-660-0108 </p>        <p style="text-align:center">工作时间 8:30-22:00</p>        </div>        <div class="bg-gray">            <div class="feed_copyright">            <p><a class="right-dotte" href="//www.csdn.net/company/index.html#about" target="_blank">关于我们</a><a href="//www.csdn.net/company/index.html#recruit" target="_blank" class="right-dotte">招聘</a><a href="//www.csdn.net/company/index.html#contact" target="_blank" class="right-dotte">广告服务</a>            <a href="https://www.csdn.net/gather/A" target="_blank" class="footer_baidu">            网站地图</a></p>            <p class="fz12_baidu"><a href="https://zn.baidu.com/cse/home/index" target="_blank"><svg width="13" height="14" xmlns="http://www.w3.org/2000/svg"><path d="M8.392 7.013c1.014 1.454 2.753 2.8 2.753 2.8s1.303 1.017.47 2.98c-.833 1.962-3.876.942-3.876.942s-1.122-.36-2.424-.072c-1.303.291-2.426.181-2.426.181s-1.523.037-1.957-1.888c-.434-1.927 1.52-2.982 1.666-3.161.145-.183 1.159-.873 1.81-1.963.653-1.09 2.608-1.962 3.984.181zm1.23 5.706V9.346H8.64v2.534h-.937s-.3-.044-.356-.285V9.33l-.925.015v2.518s.042.627.925.855h2.277zm-3.685.013V7.951l-.896-.014v1.295H3.987s-1.054.086-1.422 1.28c-.129.798.114 1.266.156 1.368.043.099.383.682 1.238.852h1.978zm-2.433-1.45c-.087-.286.013-.613.057-.741.042-.128.228-.427.61-.54h.855v1.948h-.797s-.555-.029-.725-.668zm6.877-8.775c-.143.909-.865 2.108-1.99 1.962-1.121-.144-1.375-1.16-1.267-2.179C7.214 1.458 8.21.18 9.007.364c.796.18 1.52 1.235 1.374 2.143zm-4.09-.345c0 1.197-.68 2.164-1.52 2.164S3.25 3.36 3.25 2.162C3.25.967 3.932 0 4.77 0c.842 0 1.52.967 1.52 2.162zm4.854 2.09c1.34 0 1.701 1.309 1.701 1.743 0 .438.182 2.29-1.485 2.326-1.667.037-1.737-1.126-1.737-1.96 0-.874.179-2.11 1.52-2.11zm-7.93.581c.045.398.253 2.217-1.27 2.544C.427 7.704-.14 5.947.028 5.124c0 0 .18-1.78 1.412-1.89.98-.085 1.7.986 1.774 1.6z" fill="#999" fill-rule="evenodd"></path></svg><em>百度提供站内搜索</em></a>&nbsp;<a href="http://www.miibeian.gov.cn/publish/query/indexFirst.action" target="_blank" class="ml14">京ICP备19004658号</a></p>            <p class="fz12_baidu">©1999-2019 北京创新乐知网络技术有限公司 </p>            </div>        </div>        <div class="allow-info-box">        <p><a href="https://csdnimg.cn/cdn/content-toolbar/csdn-ICP.png" target="_blank">经营性网站备案信息</a>        <em class="width126"><a href="http://www.cyberpolice.cn/" target="_blank"><span>网络110报警服务</span></a></em></p>        <p><a href="http://www.bjjubao.org/" target="_blank"><span>北京互联网违法和不良信息举报中心</span></a></p>        <p><a href="http://www.12377.cn/" target="_blank"><span>中国互联网举报中心</span></a><a href="https://download.csdn.net/index.php/tutelage/" target="_blank"><span style="margin-left:8px">家长监护</span></a><a href="https://blog.csdn.net/blogdevteam/article/details/90369522" target="_blank"><span style="margin-left:8px">版权申诉</span></a></p>        </div>        </div></div>
      	</div>
      </div>
      
    ©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页