CREATE TABLE documents (access_count INT, document_structure_code VARCHAR)

Find the average access count of documents with the least popular structure.
SELECT AVG(access_count) FROM documents GROUP BY document_structure_code ORDER BY COUNT(*) LIMIT 1
SELECT AVG("access_count") FROM "documents" GROUP BY "document_structure_code" ORDER BY COUNT(*) NULLS FIRST LIMIT 1