Step 1: Extract the start and end years from the 'years' column then add columns 'start_year' and 'end_year' to the existing table.
rank |
name |
years |
matches |
goals |
1 |
dudu georgescu |
1970-01-01 - 1986-01-01 |
370 |
252 |
2 |
ionel danciulescu |
1993-01-01 - present |
427 |
210 |
3 |
rodion camataru |
1974-01-01 - 1989-01-01 |
377 |
198 |
4 |
marin radu |
1974-01-01 - 1989-01-01 |
384 |
190 |
5 |
ion oblemenco |
1964-01-01 - 1976-01-01 |
272 |
170 |
5 |
florea dumitrache |
1966-01-01 - 1983-01-01 |
357 |
170 |
7 |
mircea sandu |
1970-01-01 - 1987-01-01 |
407 |
167 |
8 |
victor piturca |
1975-01-01 - 1989-01-01 |
301 |
166 |
9 |
mihai adam |
9999-01-01 - 1976-01-01 |
353 |
160 |
10 |
titus ozon |
1947-01-01 - 1964-01-01 |
270 |
157 |
Step 2: Select rows where the 'start_year' is greater than or equal to 1950 and the 'end_year' is less than or equal to 1965.
rank |
name |
years |
matches |
goals |
start_year |
end_year |
1 |
dudu georgescu |
1970-01-01 - 1986-01-01 |
370 |
252 |
1970 |
1-01 |
2 |
ionel danciulescu |
1993-01-01 - present |
427 |
210 |
1993 |
|
3 |
rodion camataru |
1974-01-01 - 1989-01-01 |
377 |
198 |
1974 |
1-01 |
4 |
marin radu |
1974-01-01 - 1989-01-01 |
384 |
190 |
1974 |
1-01 |
5 |
ion oblemenco |
1964-01-01 - 1976-01-01 |
272 |
170 |
1964 |
1-01 |
5 |
florea dumitrache |
1966-01-01 - 1983-01-01 |
357 |
170 |
1966 |
1-01 |
7 |
mircea sandu |
1970-01-01 - 1987-01-01 |
407 |
167 |
1970 |
1-01 |
8 |
victor piturca |
1975-01-01 - 1989-01-01 |
301 |
166 |
1975 |
1-01 |
9 |
mihai adam |
9999-01-01 - 1976-01-01 |
353 |
160 |
9999 |
1-01 |
10 |
titus ozon |
1947-01-01 - 1964-01-01 |
270 |
157 |
1947 |
1-01 |
Step 3: Extract the numerical value of 'goals' from the 'goals' column then add column 'num_goals' to the existing table.
rank |
name |
years |
matches |
goals |
start_year |
end_year |
1 |
dudu georgescu |
1970-01-01 - 1986-01-01 |
370 |
252 |
1970 |
1-01 |
2 |
ionel danciulescu |
1993-01-01 - present |
427 |
210 |
1993 |
|
3 |
rodion camataru |
1974-01-01 - 1989-01-01 |
377 |
198 |
1974 |
1-01 |
4 |
marin radu |
1974-01-01 - 1989-01-01 |
384 |
190 |
1974 |
1-01 |
5 |
ion oblemenco |
1964-01-01 - 1976-01-01 |
272 |
170 |
1964 |
1-01 |
5 |
florea dumitrache |
1966-01-01 - 1983-01-01 |
357 |
170 |
1966 |
1-01 |
7 |
mircea sandu |
1970-01-01 - 1987-01-01 |
407 |
167 |
1970 |
1-01 |
8 |
victor piturca |
1975-01-01 - 1989-01-01 |
301 |
166 |
1975 |
1-01 |
9 |
mihai adam |
9999-01-01 - 1976-01-01 |
353 |
160 |
9999 |
1-01 |
Step 4: Select rows where 'num_goals' is less than 160.
rank |
name |
years |
matches |
goals |
start_year |
end_year |
num_goals |
1 |
dudu georgescu |
1970-01-01 - 1986-01-01 |
370 |
252 |
1970 |
1-01 |
0 |
2 |
ionel danciulescu |
1993-01-01 - present |
427 |
210 |
1993 |
|
0 |
3 |
rodion camataru |
1974-01-01 - 1989-01-01 |
377 |
198 |
1974 |
1-01 |
0 |
4 |
marin radu |
1974-01-01 - 1989-01-01 |
384 |
190 |
1974 |
1-01 |
0 |
5 |
ion oblemenco |
1964-01-01 - 1976-01-01 |
272 |
170 |
1964 |
1-01 |
0 |
5 |
florea dumitrache |
1966-01-01 - 1983-01-01 |
357 |
170 |
1966 |
1-01 |
0 |
7 |
mircea sandu |
1970-01-01 - 1987-01-01 |
407 |
167 |
1970 |
1-01 |
0 |
8 |
victor piturca |
1975-01-01 - 1989-01-01 |
301 |
166 |
1975 |
1-01 |
0 |
9 |
mihai adam |
9999-01-01 - 1976-01-01 |
353 |
160 |
9999 |
1-01 |
0 |
Step 5: Use a `CASE` statement to return TRUE if the number of rows is greater than or equal to 1, otherwise return FALSE.
rank |
name |
years |
matches |
goals |
start_year |
end_year |
num_goals |
1 |
dudu georgescu |
1970-01-01 - 1986-01-01 |
370 |
252 |
1970 |
1-01 |
0 |
2 |
ionel danciulescu |
1993-01-01 - present |
427 |
210 |
1993 |
|
0 |
3 |
rodion camataru |
1974-01-01 - 1989-01-01 |
377 |
198 |
1974 |
1-01 |
0 |
4 |
marin radu |
1974-01-01 - 1989-01-01 |
384 |
190 |
1974 |
1-01 |
0 |
5 |
ion oblemenco |
1964-01-01 - 1976-01-01 |
272 |
170 |
1964 |
1-01 |
0 |
5 |
florea dumitrache |
1966-01-01 - 1983-01-01 |
357 |
170 |
1966 |
1-01 |
0 |
7 |
mircea sandu |
1970-01-01 - 1987-01-01 |
407 |
167 |
1970 |
1-01 |
0 |
8 |
victor piturca |
1975-01-01 - 1989-01-01 |
301 |
166 |
1975 |
1-01 |
0 |
9 |
mihai adam |
9999-01-01 - 1976-01-01 |
353 |
160 |
9999 |
1-01 |
0 |