UNION DISTINCT

w同结构表读写合并。

  1 DROP PROCEDURE IF EXISTS w_ww_amzasin;
  2 DELIMITER /w/
  3 CREATE PROCEDURE w_ww_amzasin()
  4 BEGIN
  5   DECLARE done INT DEFAULT FALSE;
  6   DECLARE w_asin VARCHAR(16);
  7   DECLARE w_country VARCHAR(6);
  8   DECLARE wcur CURSOR FOR
  9                         SELECT asin,country FROM grab_amzreviews_asins
 10                                 UNION DISTINCT
 11                         SELECT asin,country FROM grab_amzsimilar_seller_asins
 12                                 UNION DISTINCT
 13                         SELECT asin,country FROM grab_amzlisting
 14                                 WHERE CONCAT(asin,LOWER(country)) NOT IN
 15                                     (SELECT CONCAT(asin,LOWER(country)) FROM amzasin) ;
 16   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
 17
 18   OPEN wcur;
 19   read_loop: LOOP
 20     FETCH wcur INTO w_asin,w_country;
 21     IF done THEN LEAVE read_loop;
 22     END IF;
 23         SET @w_nothhtps=‘www.amazon.‘;
 24         SET @w_most=CONCAT(LOWER(w_country),‘/product/dp/‘,w_asin);
 25         CASE  LOWER(w_country)
 26                 WHEN ‘ca‘ THEN SELECT ‘w‘;
 27                 WHEN ‘in‘ THEN SELECT ‘w‘;
 28                 WHEN ‘es‘ THEN SELECT ‘w‘;
 29                 WHEN ‘it‘ THEN SELECT ‘w‘;
 30                 WHEN ‘fr‘ THEN SELECT ‘w‘;
 31
 32                 WHEN ‘jp‘ THEN SET @w_most=CONCAT(‘co.‘,@w_most);
 33                 WHEN ‘uk‘ THEN SET @w_most=CONCAT(‘co.‘,@w_most);
 34
 35                 WHEN ‘mx‘ THEN SET @w_most=CONCAT(‘com.‘,@w_most);
 36
 37                 WHEN ‘us‘ THEN SET @w_most=CONCAT(‘com/gp/product/‘,w_asin);
 38       ELSE
 39         BEGIN
 40         END;
 41     END CASE;
 42
 43         SET @w_nothhtps=CONCAT(@w_nothhtps,@w_most);
 44         SET @wtmp = CONCAT(‘INSERT INTO  amzasin (asin,country,url) VALUES ( "‘,w_asin,‘","‘,w_country,‘","‘,@w_nothhtps,‘")‘);
 45         PREPARE  stmt FROM @wtmp ;
 46         EXECUTE  stmt ;
 47         DROP PREPARE stmt;
 48   END LOOP;
 49   CLOSE wcur;
 50 END/w/
 51 DELIMITER;
 52 CALL w_ww_amzasin( );
 53
 54
 55
 56 DROP PROCEDURE IF EXISTS w_ww_amzasin;
 57 DELIMITER /w/
 58 CREATE PROCEDURE w_ww_amzasin()
 59 BEGIN
 60   DECLARE done INT DEFAULT FALSE;
 61   DECLARE w_asin VARCHAR(16);
 62   DECLARE w_country VARCHAR(6);
 63   DECLARE wcur CURSOR FOR SELECT asin,country FROM grab_amzlisting WHERE CONCAT(asin,LOWER(country)) NOT IN (SELECT CONCAT(asin,LOWER(country)) FROM amzasin );
 64   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
 65
 66   OPEN wcur;
 67   read_loop: LOOP
 68     FETCH wcur INTO w_asin,w_country;
 69     IF done THEN LEAVE read_loop;
 70     END IF;
 71         SET @w_nothhtps=‘www.amazon.‘;
 72         SET @w_most=CONCAT(LOWER(w_country),‘/product/dp/‘,w_asin);
 73         CASE  LOWER(w_country)
 74                 WHEN ‘ca‘ THEN SELECT ‘w‘;
 75                 WHEN ‘in‘ THEN SELECT ‘w‘;
 76                 WHEN ‘es‘ THEN SELECT ‘w‘;
 77                 WHEN ‘it‘ THEN SELECT ‘w‘;
 78                 WHEN ‘fr‘ THEN SELECT ‘w‘;
 79
 80                 WHEN ‘jp‘ THEN SET @w_most=CONCAT(‘co.‘,@w_most);
 81                 WHEN ‘uk‘ THEN SET @w_most=CONCAT(‘co.‘,@w_most);
 82
 83                 WHEN ‘mx‘ THEN SET @w_most=CONCAT(‘com.‘,@w_most);
 84
 85                 WHEN ‘us‘ THEN SET @w_most=CONCAT(‘com/gp/product/‘,w_asin);
 86       ELSE
 87         BEGIN
 88         END;
 89     END CASE;
 90
 91         SET @w_nothhtps=CONCAT(@w_nothhtps,@w_most);
 92         SET @wtmp = CONCAT(‘INSERT INTO  amzasin (asin,country,url) VALUES ( "‘,w_asin,‘","‘,w_country,‘","‘,@w_nothhtps,‘")‘);
 93         PREPARE  stmt FROM @wtmp ;
 94         EXECUTE  stmt ;
 95         DROP PREPARE stmt;
 96   END LOOP;
 97   CLOSE wcur;
 98 END/w/
 99 DELIMITER;
100 CALL w_ww_amzasin( );
101
102 DROP PROCEDURE IF EXISTS w_ww_amzasin;
103 DELIMITER /w/
104 CREATE PROCEDURE w_ww_amzasin()
105 BEGIN
106   DECLARE done INT DEFAULT FALSE;
107   DECLARE w_asin VARCHAR(16);
108   DECLARE w_country VARCHAR(6);
109   DECLARE wcur CURSOR FOR SELECT asin,country FROM grab_amzsimilar_seller_asins WHERE CONCAT(asin,LOWER(country)) NOT IN (SELECT CONCAT(asin,LOWER(country)) FROM amzasin );
110   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
111
112   OPEN wcur;
113   read_loop: LOOP
114     FETCH wcur INTO w_asin,w_country;
115     IF done THEN LEAVE read_loop;
116     END IF;
117         SET @w_nothhtps=‘www.amazon.‘;
118         SET @w_most=CONCAT(LOWER(w_country),‘/product/dp/‘,w_asin);
119         CASE  LOWER(w_country)
120                 WHEN ‘ca‘ THEN SELECT ‘w‘;
121                 WHEN ‘in‘ THEN SELECT ‘w‘;
122                 WHEN ‘es‘ THEN SELECT ‘w‘;
123                 WHEN ‘it‘ THEN SELECT ‘w‘;
124                 WHEN ‘fr‘ THEN SELECT ‘w‘;
125
126                 WHEN ‘jp‘ THEN SET @w_most=CONCAT(‘co.‘,@w_most);
127                 WHEN ‘uk‘ THEN SET @w_most=CONCAT(‘co.‘,@w_most);
128
129                 WHEN ‘mx‘ THEN SET @w_most=CONCAT(‘com.‘,@w_most);
130
131                 WHEN ‘us‘ THEN SET @w_most=CONCAT(‘com/gp/product/‘,w_asin);
132       ELSE
133         BEGIN
134         END;
135     END CASE;
136
137         SET @w_nothhtps=CONCAT(@w_nothhtps,@w_most);
138         SET @wtmp = CONCAT(‘INSERT INTO  amzasin (asin,country,url) VALUES ( "‘,w_asin,‘","‘,w_country,‘","‘,@w_nothhtps,‘")‘);
139         PREPARE  stmt FROM @wtmp ;
140         EXECUTE  stmt ;
141         DROP PREPARE stmt;
142   END LOOP;
143   CLOSE wcur;
144 END/w/
145 DELIMITER;
146 CALL w_ww_amzasin( );
147
148 DROP PROCEDURE IF EXISTS w_ww_amzasin;
149 DELIMITER /w/
150 CREATE PROCEDURE w_ww_amzasin()
151 BEGIN
152   DECLARE done INT DEFAULT FALSE;
153   DECLARE w_asin VARCHAR(16);
154   DECLARE w_country VARCHAR(6);
155   DECLARE wcur CURSOR FOR SELECT asin,country FROM grab_amzreviews_asins WHERE CONCAT(asin,LOWER(country)) NOT IN (SELECT CONCAT(asin,LOWER(country)) FROM amzasin );
156   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
157
158   OPEN wcur;
159   read_loop: LOOP
160     FETCH wcur INTO w_asin,w_country;
161     IF done THEN LEAVE read_loop;
162     END IF;
163         SET @w_nothhtps=‘www.amazon.‘;
164         SET @w_most=CONCAT(LOWER(w_country),‘/product/dp/‘,w_asin);
165         CASE  LOWER(w_country)
166                 WHEN ‘ca‘ THEN SELECT ‘w‘;
167                 WHEN ‘in‘ THEN SELECT ‘w‘;
168                 WHEN ‘es‘ THEN SELECT ‘w‘;
169                 WHEN ‘it‘ THEN SELECT ‘w‘;
170                 WHEN ‘fr‘ THEN SELECT ‘w‘;
171
172                 WHEN ‘jp‘ THEN SET @w_most=CONCAT(‘co.‘,@w_most);
173                 WHEN ‘uk‘ THEN SET @w_most=CONCAT(‘co.‘,@w_most);
174
175                 WHEN ‘mx‘ THEN SET @w_most=CONCAT(‘com.‘,@w_most);
176
177                 WHEN ‘us‘ THEN SET @w_most=CONCAT(‘com/gp/product/‘,w_asin);
178       ELSE
179         BEGIN
180         END;
181     END CASE;
182
183         SET @w_nothhtps=CONCAT(@w_nothhtps,@w_most);
184         SET @wtmp = CONCAT(‘INSERT INTO  amzasin (asin,country,url) VALUES ( "‘,w_asin,‘","‘,w_country,‘","‘,@w_nothhtps,‘")‘);
185         PREPARE  stmt FROM @wtmp ;
186         EXECUTE  stmt ;
187         DROP PREPARE stmt;
188   END LOOP;
189   CLOSE wcur;
190 END/w/
191 DELIMITER;
192 CALL w_ww_amzasin( );
193
194
195
196
197
198  
时间: 2024-10-21 03:18:14

UNION DISTINCT的相关文章

spark 教程三 spark Map filter flatMap union distinct intersection操作

RDD的创建 spark 所有的操作都围绕着弹性分布式数据集(RDD)进行,这是一个有容错机制的并可以被并行操作的元素集合,具有只读.分区.容错.高效.无需物化.可以缓存.RDD依赖等特征 RDD的创建基础RDD 1.并行集合(Parallelized Collections):接收一个已经存在的Scala集合,然后进行各种并行运算 var sc=new SparkContext(conf) var rdd=sc.parallelize(Array(2,4,9,3,5,7,8,1,6)); rd

数据库distinct、union、exists等技术总结

一.mysql distinct技术点 1,创建table: create table t1 (id varchar, name varchar); 2,插入数据: insert into t1 values(1,a); insert into t1 values(2,b); insert into t1 values(3,c); insert into t1 values(4,c); insert into t1 values(5,b); 3,查询不重复name: select distinc

sql注入绕过union select过滤

1 # 2 # 3 # 4 #WAF Bypassing Strings: 5 6 /*!%55NiOn*/ /*!%53eLEct*/ 7 8 %55nion(%53elect 1,2,3)-- - 9 10 +union+distinct+select+ 11 12 +union+distinctROW+select+ 13 14 /**//*!12345UNION SELECT*//**/ 15 16 /**//*!50000UNION SELECT*//**/ 17 18 /**/UNI

UNION(并集)集合运算

在集合论中,两个集合(记为集合A和B)的并集是一个包含集合A和B中所有元素的集合.换句话说,如果一个元素属于任何一个输入集合,那么它也属于结果集. 在T-SQL中,UNION 集合运算可以将两个输入查询的结果集组合成一个结果集.如果一个行在任何一个输入集合中出现,它也会在UNION运算的结果中出现.T-SQL 支持在UNION集合运算中使用UNION ALL 和UNION(隐含DISTINCT,DISTINCT不能显示指定)选项. UNION ALL 集合运算 对于作为运算的输入查询而生成的多集

UNION并集运算

在集合论中,两个集合(集合A和集合B)的并集是一个包含集合A和B中所有元素的集合.换句话说,如果一个元素属于任何一个输入集合,那么它也属于结果集.如图所示. UNION集合运算分为UNION ALL和UNION DISTINCT两种情形,它们的区别是UNION ALL会保留重复行,而UNION DISTINCT会删除重复行.下面用例子来说明. UNION ALL UNION ALL合并两个集合,并保留重复行.例如. SQL查询代码: USE TSQLFundamentals2008; GO --

mysql中 union连接

SELECT ... UNION [ALL | DISTINCT] SELECT ... [UNION [ALL | DISTINCT] SELECT ...] UNION用于把来自许多SELECT语句的结果组合到一个结果集合中. 列于每个SELECT语句的对应位置的被选择的列应具有相同的类型.(例如,被第一个语句选择的第一列应和被其它语句选择的第一列具有相同的类型.)在第一个SELECT语句中被使用的列名称也被用于结果的列名称. SELECT语句为常规的选择语句,但是受到如下的限定: ·   

[转载]我的WafBypass之道(SQL注入篇)

现在位置: 首页 > 文章 > Web安全 > 正文 我的WafBypass之道(SQL注入篇) 2016 /11/23 16:16 6,444 评论 3 条 [本文转自安全脉搏战略合作伙伴先知技术社区 原帖地址  安全脉搏编辑huan9740整理发布] 0x00 前言 去年到现在就一直有人希望我出一篇关于waf绕过的文章,我觉得这种老生常 谈的话题也没什么可写的. 很多人一遇到waf就发懵,不知如何是好,能搜到的各 种姿势也是然并卵. 但是积累姿势的过程也是迭代的,那么就有了此文,用来

MaxCompute SQL 现状与展望

票选最美云上大数据暨大数据技术峰会上,阿里云飞天一部高级专家振禹为大家带来题为"MaxCompute SQL 现状与展望"的演讲.本文重点解析了MaxCompute SQL 现状,详细介绍了各种功能,其中包括编译器用户友好功能.复杂类型.CTE.参数化视图和SEMI JION等,接着说明了MaxCompute SQL即将完成与推进中的功能,最后作了简要总结. 以下是精彩内容整理: MaxCompute SQL 现状 目前MaxCompute SQL能力不是很强,虽然在性能.安全和成本控

direct path write temp引起的数据库重启以及ogg进程停止

集中客户系统在2016年11月8日17点业务反馈系统链接不上,是不是有问题.当即查看系统 [[email protected] hwbackup3]$crs_stat -t -v Name           Type           R/RA   F/FT   Target    State     Host ---------------------------------------------------------------------- ora....D1.inst appli