-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathegr_figure1.sql
203 lines (83 loc) · 3.81 KB
/
egr_figure1.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
---- Figure 1 Size of the MNE groups by country in 2017 -----------------------------
---In the second table of dissemination report DISS_T2, the enterprise groups are categorized by number of legal units.
drop table diss_t2;
create table diss_t2(
country varchar2(5),
"1000_or_more" number,
"500_to_999" number,
"250_to_499" number,
"50_to_249" number,
"20_to_49" number,
"10_to_19" number,
"3_to_9" number,
"2" number);
insert into diss_t2
select geg_uci_country_code,0,0,0,0,0,0,0,0
from diss_groups
where geg_uci_country_code in ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GB','GR','HR','HU','IE','IT','LT','LU','LV','MT','NL','PL','PT','RO','SE','SI','SK','IS','LI','CH','NO')
group by geg_uci_country_code
order by geg_uci_country_code;
update diss_t2
set "1000_or_more" = ( select count(geg_egr_id)
from ta_fats_gegs
where geg_uci_country_code =diss_t2.country and frame_id=100051
and GEG_LEU_COUNT>999)
where exists (select geg_uci_country_code
from ta_fats_gegs
where geg_uci_country_code = diss_t2.country);
update diss_t2
set "500_to_999" = ( select count(geg_egr_id)
from ta_fats_gegs
where geg_uci_country_code =diss_t2.country and frame_id=100051
and GEG_LEU_COUNT>499 and GEG_LEU_COUNT<1000)
where exists (select geg_uci_country_code
from ta_fats_gegs
where geg_uci_country_code = diss_t2.country);
update diss_t2
set "250_to_499" = ( select count(geg_egr_id)
from ta_fats_gegs
where geg_uci_country_code =diss_t2.country and frame_id=100051
and GEG_LEU_COUNT>249 and GEG_LEU_COUNT<500)
where exists (select geg_uci_country_code
from ta_fats_gegs
where geg_uci_country_code = diss_t2.country);
update diss_t2
set "50_to_249" = ( select count(geg_egr_id)
from ta_fats_gegs
where geg_uci_country_code =diss_t2.country and frame_id=100051
and GEG_LEU_COUNT>49 and GEG_LEU_COUNT<250)
where exists (select geg_uci_country_code
from ta_fats_gegs
where geg_uci_country_code = diss_t2.country);
update diss_t2
set "20_to_49" = ( select count(geg_egr_id)
from ta_fats_gegs
where geg_uci_country_code =diss_t2.country and frame_id=100051
and GEG_LEU_COUNT>19 and GEG_LEU_COUNT<50)
where exists (select geg_uci_country_code
from ta_fats_gegs
where geg_uci_country_code = diss_t2.country);
update diss_t2
set "10_to_19" = ( select count(geg_egr_id)
from ta_fats_gegs
where geg_uci_country_code =diss_t2.country and frame_id=100051
and GEG_LEU_COUNT>9 and GEG_LEU_COUNT<20)
where exists (select geg_uci_country_code
from ta_fats_gegs
where geg_uci_country_code = diss_t2.country);
update diss_t2
set "3_to_9" = ( select count(geg_egr_id)
from ta_fats_gegs
where geg_uci_country_code =diss_t2.country and frame_id=100051
and GEG_LEU_COUNT>2 and GEG_LEU_COUNT<10
where exists (select geg_uci_country_code
from ta_fats_gegs
where geg_uci_country_code = diss_t2.country);
update diss_t2
set "2" = ( select count(geg_egr_id)
from ta_fats_gegs
where geg_uci_country_code =diss_t2.country and frame_id=100051
and GEG_LEU_COUNT=2)
where exists (select geg_uci_country_code
from ta_fats_gegs
where geg_uci_country_code = diss_t2.country);