mysql 练习题

Posted linbobo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 练习题相关的知识,希望对你有一定的参考价值。

 

 

 1 with temp1 as (
 2 select 1 as id ,111 as barCode,\'A1\' name  union 
 3 select 2 as id ,112 as barCode,\'A2\' name union 
 4 select 3 as id ,200 as barCode,\'B1\' name union 
 5 select 4 as id ,230 as barCode,\'B2\' name union 
 6 select 5 as id ,140 as barCode,\'B3\' name 
 7 ), temp2 as (
 8 select 1 as id ,112 as barCode,10 as Amount,\'2013-10-20\' Dates  union 
 9 select 2 as id ,112 as barCode,20 as Amount,\'2013-12-20\' Dates union 
10 select 3 as id ,200 as barCode,25 as Amount,\'2014-01-08\' Dates union 
11 select 4 as id ,230 as barCode,30 as Amount,\'2014-03-15\' Dates union 
12 select 5 as id ,112 as barCode,40 as Amount,\'2014-08-7\' Dates union
13 select 5 as id ,230 as barCode,70 as Amount,\'2014-09-01\' Dates 
14 
15 )
16 
17 
18 
19 
20 /*
21 select t2.barCode,t1.name,t2.Amount,t2.dates
22 from temp2 t2 inner join temp1 t1 on t2.barCode=t1.barCode
23 where t1.name like \'B%\' and DATES >\'2014-01-01\' ;
24 */
25 
26 /*
27 select  t2.barCode,t1.name,sum(t2.amount) cnt
28 from temp2 t2 left  join temp1 t1 on t2.barCode=t1.barCode
29 group by t2.barcode
30 */
31 
32 /*
33 select  t2.barCode,t1.name,count(1) cnt
34 from temp2 t2 left  join temp1 t1 on t2.barCode=t1.barCode
35 group by t2.barcode
36 having count(t2.barCode)>1
37 */
View Code

 

 

 

 

 

 

以上是关于mysql 练习题的主要内容,如果未能解决你的问题,请参考以下文章

部分代码片段

linux中怎么查看mysql数据库版本

csharp Epicor标准练习片段

golang 去练习片段

从mysql的片段中加载ListView

连接MySQL出现错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)(代码片段