一个sql很多个not like的简化语句
如:
select * from table where `zongbu` not like '%北京%' and `zongbu` not
like '%上海%' and `zongbu` not like '%深圳%' and `zongbu` not like '天津'
and `zongbu` not like '香港' and `zongbu` not like '沈阳';
SELECT * FROM table WHERE zongbu NOT REGEXP '北京|上海|深圳|天津|香港|沈阳';
GRANT ALL PRIVILEGES ON *.* TO admin@localhost IDENTIFIED BY '222222' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO admin@"%" IDENTIFIED BY '222222' WITH GRANT OPTION; 货品表
update iac_goods a,iac_goods_base b set a.goods_desc=b.goods_desc where a.goods_desc='' and b.goods_desc<>'' and b.g_id=goods_id; select goods_id,b.g_id,a.goods_desc,b.goods_desc from iac_goods as a ,iac_goods_base as b where a.goods_desc='' and b.goods_desc<>'' and b.g_id=goods_id; select goods_id,b.g_id,a.goods_desc,b.goods_desc from iac_goods as a ,iac_goods_base as b where a.goods_desc='' and b.g_id=goods_id; //商品表 select g_id,goods_name,goods_desc from iac_goods_base where goods_desc<>''; select goods_id goods_sn from iac_goods where goods_sn=''; update iac_goods set goods_sn=concat('IAC', goods_id) where goods_sn='' or goods_sn not like 'IAC%'; update iac_goods set goods_sn=concat('IAC', goods_id) where goods_sn='' or goods_sn not like '%IAC%'; select goods_id ,goods_sn from iac_goods where goods_sn not like 'IAC%'; select * from table where `zongbu` not like '%北京%' and `zongbu` not like '%上海%' and `zongbu` not like '%深圳%' and `zongbu` not like '天津' and `zongbu` not like '香港' and `zongbu` not like '沈阳' SELECT * FROM table WHERE zongbu NOT REGEXP '北京|上海|深圳|天津|香港|沈阳';
//从另一个表insert多条记录
insert into goods(goods_name,goods_price,goods_num,goods_desc,pubtime,goods_pic) select goods_name,goods_price,goods_num,goods_desc,pubtime,goods_pic from goods;
一个sql很多个not like的简化语句的更多相关文章
- 如何跑通第一个 SQL 作业
简介: 本文由阿里巴巴技术专家周凯波(宝牛)分享,主要介绍如何跑通第一个SQL. 一.SQL的基本概念 1.SQL 分类 SQL分为四类,分别是数据查询语言(DQL).数据操纵语言(DML).数据定义 ...
- 如何实现一个SQL解析器
作者:vivo 互联网搜索团队- Deng Jie 一.背景 随着技术的不断的发展,在大数据领域出现了越来越多的技术框架.而为了降低大数据的学习成本和难度,越来越多的大数据技术和应用开始支持SQL进 ...
- Oracle数据库该如何着手优化一个SQL
这是个终极问题,因为优化本身的复杂性实在是难以总结的,很多时候优化的方法并不是用到了什么高深莫测的技术,而只是一个思想意识层面的差异,而这些都很可能连带导致性能表现上的巨大差异. 所以有时候我们应该先 ...
- 用scala实现一个sql执行引擎-(上)
前言 在实时计算中,通常是从队列中收集原始数据,这种原始数据在内存中通常是一个java bean,把数据收集过来以后,通常会把数据落地到数据库,供后面的ETL使用.举个一个简单的例子,对一个游戏来说, ...
- SqlServer 中如何查看某一个Sql语句是复用了执行计划,还是重新生成了执行计划
我们知道SqlServer的查询优化器会将所执行的Sql语句的执行计划作缓存,如果后续查询可以复用缓存中的执行计划,那么SqlServer就会为后续查询复用执行计划而不是重新生成一个新的执行计划,因为 ...
- sql---如何把sql查询出来的结果当做另一个sql的条件查询,1、语句2、with as
'; -- table2 的 name 作为 table1的条件 select * from table1 where name in (select name from table2) --如果有多 ...
- DIY:从零开始写一个 SQL 构建器
最近在项目中遇到了一个棘手的问题,因为 EF Core 不支持直接生成 Update 语句,所以这个项目就用到了 EFCore.Plus 来实现这个功能,但是 EFCore.Plus 对 SQLite ...
- 如何让索引只能被一个SQL使用
有个徒弟问我,要创建一个索引,去优化一个SQL,但是创建了索引之后其他 SQL 也要用 这个索引,其他SQL慢死了,要优化的SQL又快.遇到这种问题咋搞? 一般遇到这种问题还是很少的.处理的方法很多. ...
- 给隔壁的妹子讲『一个SQL语句是如何执行的?』
前言 SQL作为Web开发是永远离开不的一个话题,天天写SQL,可是你知道一个SQL是如何执行的吗? select name from user where id = 1; 上面是一个简单的查询语句, ...
随机推荐
- 再看ADO对象模型
在敲学生管理系统之前,我们就学习过ADO的有关知识.但是昨天被问到ADO的几个对象,顿时无言!为什么会出现这样的结果呢,明明是学习过了,而且也实践过(红皮书的五个例子).这充分说明了,在以往的学习过程 ...
- [Javascript] Redirect the browser using JavaScript
Three methods to preform redirection in browser: widnow.location.href window.location.assign window. ...
- git删除未跟踪文件
# 删除 untracked files git clean -f # 连 untracked 的目录也一起删掉 git clean -fd # 连 gitignore 的untrack 文件 ...
- 关于sys、system、sysman等在EM中登录的问题
1.sysman要先在SQL*Plus上解锁: (1)以"sysdba"的身份登录 conn system/密码 as sysdba; (2)解锁 alter user sysma ...
- F# 天生就是就异步和并行的料
做模型开发免不了要使用异步和并行计算,尤其在多核CPU的今天,更是如此,F#恰逢其时,天生就具备这种能力,先看一个例子. open System open System.Drawing open Sy ...
- windows程序消息机制(Winform界面更新有关)--转
1. Windows程序消息机制 Windows GUI程序是基于消息机制的,有个主线程维护着消息泵.这个消息泵让windows程序生生不息. Windows程序有个消息队列,窗体上的所有消息是这个队 ...
- Android下按钮的使用方法
package com.hangsheng.button; import android.app.Activity; import android.os.Bundle; import android. ...
- 使用java对sql server进行增删改查
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import ...
- createjs基础
<canvas id="gameView" width="400px" height="400px" style="back ...
- linux 下配置mysql区分大小写(不区分可能出现找不到表的情况)怎么样使用yum来安装mysql
Linux 默认情况下,数据库是区分大小写的:因此,要将mysql设置成不区分大小写 在my.cof 设置 lower_case_table_names=1(1忽略大小写,0区分大小写) 检查方式:在 ...