Tested in Magento Commerce 2.4.1
This will give you a list of simple products that don't have any parent/child mapping with a configurable product, using a simple left join.
select * from catalog_product_entity e
left join catalog_product_super_link sl on sl.product_id = e.row_id
where sl.product_id is null
and e.type_id = 'simple';
Similarly...
This will give the configurable products with no child assigned.
select *, count(sl.parent_id)
from catalog_product_entity e
left join catalog_product_super_link sl on sl.parent_id = e.row_id
where e.type_id = 'configurable'
group by sl.parent_id
having count(sl.parent_id) = 0;
Note: catalog_product_super_link
table keeps the relationship of the parent to child for configurable products and it uses the row_id
field to map, NOT the entity_id
.