SELECT
    parent_id AS folder_id,
    COUNT(filename) FILTER (WHERE permissions LIKE '%__x%') AS nb_executables
FROM dtf.madelines_files
GROUP BY parent_id
HAVING COUNT(filename) FILTER (WHERE permissions LIKE '%__x%') >= 3
ORDER BY parent_id ASC NULLS FIRST
