@@ -4,69 +4,69 @@ select *
4
4
from
5
5
(select count (* ) h8_30_to_9
6
6
from {{store_sales}}, {{household_demographics}} , {{time_dim}}, {{store}}
7
- where ss_sold_time_sk = time_dim .t_time_sk
8
- and ss_hdemo_sk = household_demographics .hd_demo_sk
7
+ where ss_sold_time_sk = time_dim .t_time_sk
8
+ and ss_hdemo_sk = household_demographics .hd_demo_sk
9
9
and ss_store_sk = s_store_sk
10
10
and time_dim .t_hour = 8
11
11
and time_dim .t_minute >= 30
12
- and ((household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
13
- (household_demographics .hd_dep_count = 0 and household_demographics .hd_vehicle_count <= 0 + 2 ) or
14
- (household_demographics .hd_dep_count = 1 and household_demographics .hd_vehicle_count <= 1 + 2 ))
12
+ and ((household_demographics .hd_dep_count = 2 and household_demographics .hd_vehicle_count <= 2 + 2 ) or
13
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 4 + 2 ) or
14
+ (household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ))
15
15
and store .s_store_name = ' ese' ) s1,
16
- (select count (* ) h9_to_9_30
16
+ (select count (* ) h9_to_9_30
17
17
from {{store_sales}}, {{household_demographics}} , {{time_dim}}, {{store}}
18
18
where ss_sold_time_sk = time_dim .t_time_sk
19
19
and ss_hdemo_sk = household_demographics .hd_demo_sk
20
- and ss_store_sk = s_store_sk
21
- and time_dim .t_hour = 9
20
+ and ss_store_sk = s_store_sk
21
+ and time_dim .t_hour = 9
22
22
and time_dim .t_minute < 30
23
- and ((household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
24
- (household_demographics .hd_dep_count = 0 and household_demographics .hd_vehicle_count <= 0 + 2 ) or
25
- (household_demographics .hd_dep_count = 1 and household_demographics .hd_vehicle_count <= 1 + 2 ))
23
+ and ((household_demographics .hd_dep_count = 2 and household_demographics .hd_vehicle_count <= 2 + 2 ) or
24
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 4 + 2 ) or
25
+ (household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ))
26
26
and store .s_store_name = ' ese' ) s2,
27
- (select count (* ) h9_30_to_10
27
+ (select count (* ) h9_30_to_10
28
28
from {{store_sales}}, {{household_demographics}} , {{time_dim}}, {{store}}
29
29
where ss_sold_time_sk = time_dim .t_time_sk
30
30
and ss_hdemo_sk = household_demographics .hd_demo_sk
31
31
and ss_store_sk = s_store_sk
32
32
and time_dim .t_hour = 9
33
33
and time_dim .t_minute >= 30
34
- and ((household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
35
- (household_demographics .hd_dep_count = 0 and household_demographics .hd_vehicle_count <= 0 + 2 ) or
36
- (household_demographics .hd_dep_count = 1 and household_demographics .hd_vehicle_count <= 1 + 2 ))
34
+ and ((household_demographics .hd_dep_count = 2 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
35
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 4 + 2 ) or
36
+ (household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ))
37
37
and store .s_store_name = ' ese' ) s3,
38
38
(select count (* ) h10_to_10_30
39
39
from {{store_sales}}, {{household_demographics}} , {{time_dim}}, {{store}}
40
40
where ss_sold_time_sk = time_dim .t_time_sk
41
41
and ss_hdemo_sk = household_demographics .hd_demo_sk
42
42
and ss_store_sk = s_store_sk
43
- and time_dim .t_hour = 10
43
+ and time_dim .t_hour = 10
44
44
and time_dim .t_minute < 30
45
- and ((household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
46
- (household_demographics .hd_dep_count = 0 and household_demographics .hd_vehicle_count <= 0 + 2 ) or
47
- (household_demographics .hd_dep_count = 1 and household_demographics .hd_vehicle_count <= 1 + 2 ))
45
+ and ((household_demographics .hd_dep_count = 2 and household_demographics .hd_vehicle_count <= 2 + 2 ) or
46
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 4 + 2 ) or
47
+ (household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ))
48
48
and store .s_store_name = ' ese' ) s4,
49
49
(select count (* ) h10_30_to_11
50
50
from {{store_sales}}, {{household_demographics}} , {{time_dim}}, {{store}}
51
51
where ss_sold_time_sk = time_dim .t_time_sk
52
52
and ss_hdemo_sk = household_demographics .hd_demo_sk
53
53
and ss_store_sk = s_store_sk
54
- and time_dim .t_hour = 10
54
+ and time_dim .t_hour = 10
55
55
and time_dim .t_minute >= 30
56
- and ((household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
57
- (household_demographics .hd_dep_count = 0 and household_demographics .hd_vehicle_count <= 0 + 2 ) or
58
- (household_demographics .hd_dep_count = 1 and household_demographics .hd_vehicle_count <= 1 + 2 ))
56
+ and ((household_demographics .hd_dep_count = 2 and household_demographics .hd_vehicle_count <= 2 + 2 ) or
57
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 4 + 2 ) or
58
+ (household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ))
59
59
and store .s_store_name = ' ese' ) s5,
60
60
(select count (* ) h11_to_11_30
61
61
from {{store_sales}}, {{household_demographics}} , {{time_dim}}, {{store}}
62
62
where ss_sold_time_sk = time_dim .t_time_sk
63
63
and ss_hdemo_sk = household_demographics .hd_demo_sk
64
- and ss_store_sk = s_store_sk
64
+ and ss_store_sk = s_store_sk
65
65
and time_dim .t_hour = 11
66
66
and time_dim .t_minute < 30
67
- and ((household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
68
- (household_demographics .hd_dep_count = 0 and household_demographics .hd_vehicle_count <= 0 + 2 ) or
69
- (household_demographics .hd_dep_count = 1 and household_demographics .hd_vehicle_count <= 1 + 2 ))
67
+ and ((household_demographics .hd_dep_count = 2 and household_demographics .hd_vehicle_count <= 2 + 2 ) or
68
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 4 + 2 ) or
69
+ (household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ))
70
70
and store .s_store_name = ' ese' ) s6,
71
71
(select count (* ) h11_30_to_12
72
72
from {{store_sales}}, {{household_demographics}} , {{time_dim}}, {{store}}
75
75
and ss_store_sk = s_store_sk
76
76
and time_dim .t_hour = 11
77
77
and time_dim .t_minute >= 30
78
- and ((household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
79
- (household_demographics .hd_dep_count = 0 and household_demographics .hd_vehicle_count <= 0 + 2 ) or
80
- (household_demographics .hd_dep_count = 1 and household_demographics .hd_vehicle_count <= 1 + 2 ))
78
+ and ((household_demographics .hd_dep_count = 2 and household_demographics .hd_vehicle_count <= 2 + 2 ) or
79
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 4 + 2 ) or
80
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 3 + 2 ))
81
81
and store .s_store_name = ' ese' ) s7,
82
82
(select count (* ) h12_to_12_30
83
83
from {{store_sales}}, {{household_demographics}} , {{time_dim}}, {{store}}
86
86
and ss_store_sk = s_store_sk
87
87
and time_dim .t_hour = 12
88
88
and time_dim .t_minute < 30
89
- and ((household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ) or
90
- (household_demographics .hd_dep_count = 0 and household_demographics .hd_vehicle_count <= 0 + 2 ) or
91
- (household_demographics .hd_dep_count = 1 and household_demographics .hd_vehicle_count <= 1 + 2 ))
89
+ and ((household_demographics .hd_dep_count = 2 and household_demographics .hd_vehicle_count <= 2 + 2 ) or
90
+ (household_demographics .hd_dep_count = 4 and household_demographics .hd_vehicle_count <= 4 + 2 ) or
91
+ (household_demographics .hd_dep_count = 3 and household_demographics .hd_vehicle_count <= 3 + 2 ))
92
92
and store .s_store_name = ' ese' ) s8
93
93
;
94
94
0 commit comments