Geo-targeting Project [20-25]
We will now generate the list of postcodes that are within 4.5 km of the three stores that we selected.
The code below finds all the postcodes that are within 4.5 km of the stores:
create table target_postcode as
round(((b.os_x - a.os_x)**2 + (b.os_y - a.os_y)**2) **0.5, 1) as dist
from all_postcode a, locations b
where b.postcode in
from target) and
calculated dist <= 4500;
Did the code fail?
Copy and run the code below to create the input data sets.
There are 42408 postcodes that fall within the range of 4.5 km from the selected stores: