I think configuring role memberships using direct SQL statements would be complicated - the data and relationships involved are complex.
However role memberships can be configured using a business adapter, so that might be an approach to consider.
(Did my reply solve the question? Click "ACCEPT AS SOLUTION" to help others find answers faster. Liked something? Click "KUDO". Anything expressed here is my own view and not necessarily that of my employer, Flexera.)