Postgres/Postgis Spatial query and update

Job ID: 32778049

Budget: $10 – $30 USD

I need SQL script to update one table using another table for selected records form both tables.
I have one table with countries for all world (COUNTRY table). The table has a geometry field (polygon). Record represent a country with country code. It is a referential table. Next, I have table (ROADS) represent roads for all world. In the table, I've empty field named country_code, which I have to fill country code from COUNTRY table. Additional I need to decide witch country will be processed.
I think, that it should work like that: Q1. select on countries using county code. Q2 spatial query on roads using the Q1 (details will be given). Q3 Update ROADS table using Q2. Note, that I need filter both input sources - due huge data amount.

In general, features should divide on country borders, so they can touch border in one point from each country. You should take it into account in spatial query.