How many {academic degree} are to/by {physician} ?
What academic degree do physicians have?
Physicians have what academic degree?
SELECT ( COUNT ( ?l ) AS ?y ) { ?l property:academic_degree resource:physician }
SELECT (COUNT(?sub) AS ?subs ) {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?sub .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P512> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q39631 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P512 wd:Q39631 }
9