Disclaimer: Please make a backup of your database and/or test on a copy before trying out the query!
To set the first found customer address as default shipping address, use
INSERT INTO customer_entity_int (entity_id, entity_type_id, attribute_id, value)
WHERE attribute_code = 'default_shipping'),
FROM customer_entity e
LEFT JOIN customer_entity_int v
ON v.entity_id = e.entity_id
AND v.attribute_id = (SELECT
WHERE attribute_code = 'default_shipping')
INNER JOIN customer_address_entity address
ON address.parent_id = e.entity_id
WHERE value_id IS NULL
GROUP BY e.entity_id
Then repeat with
'default_shipping' replaced by
'default_billing' in both places.
This will probably set the same address as default for both but since it is an arbitrary choice anyway I did not go the extra mile to write a second query that compares the address against the assigned shipping address.
Updated with tested query