SELECT taxonName, taxonKey, COUNT(distinct bioRecordKey) 	 
FROM  taxon, bioRecord
where family = 'Poaceae'
  AND taxonKey = bioRecordTaxonKey  
GROUP BY taxonKey, taxonName

SELECT taxonName, taxonKey, COUNT(distinct bioRecordKey) 
FROM taxon , bioRecord, isoCountry 
WHERE bioRecordTaxonKey = taxon.taxonKey
 AND family = 'Poaceae'
 AND isoCountryCode = bioRecordCountryCode
 AND countryName = 'UNITED KINGDOM' 
GROUP BY taxonKey, taxonName

SELECT taxonName, taxonKey, COUNT(distinct bioRecordKey) 
FROM taxon , bioRecord, imageRecord, isoCountry 
WHERE /*bioRecordTaxonKey*/ imageRecordTaxonKey = taxon.taxonKey
  AND bioRecordKey = imagerecordbiorecordkey
  AND family =  'Poaceae'
	AND isoCountryCode = bioRecordCountryCode
	AND countryName = 'UNITED KINGDOM' 
GROUP BY taxonKey, taxonName

explain
SELECT taxonName, taxonKey, COUNT(distinct bioRecordKey)
FROM taxon , bioRecord, imageRecord
WHERE /*bioRecordTaxonKey*/ imageRecordTaxonKey = taxon.taxonKey
  AND bioRecordKey =  imagerecordbiorecordkey 	
  AND family = 'Poaceae'
GROUP BY taxonKey, taxonName

SELECT taxonName, taxonKey, COUNT(distinct bioRecordKey)
from taxon, bioRecord
WHERE family = 'Poaceae'
  AND taxonKey = bioRecordTaxonKey  
GROUP BY taxonKey, taxonName

SELECT taxonName, taxonKey, COUNT(distinct bioRecordKey)
from bioRecord, taxon
WHERE bioRecordTaxonKey = taxonKey
  AND CONTAINS(localityText, 'paris')
  AND family = 'Poaceae'
GROUP BY taxonKey, taxonName

SELECT taxonName, taxonKey, COUNT(distinct bioRecordKey)
from bioRecord, taxon
WHERE bioRecordTaxonKey = taxonKey
  AND CONTAINS(collector, 'muller')
GROUP BY taxonKey, taxonName

SELECT taxonName, taxonKey,
COUNT(distinct bioRecordKey) 
from bioRecord, taxon, vernacularName
WHERE bioRecordTaxonKey = taxonKey
  AND vernacularTaxonKey = bioRecordTaxonKey
  AND vernacularName = 'fox grape'
  AND CONTAINS(localityText, 'paris')
GROUP BY taxonKey, taxonName

SELECT taxon.taxonKey, taxonName, COUNT(distinct bioRecordKey)
FROM imageRecord, bioRecord, taxon, higherTaxon
WHERE higherTaxon.taxonKey = taxon.taxonKey
  AND /*bioRecordTaxonKey*/ imageRecordTaxonKey = higherTaxon.taxonKey
  AND bioRecordKey =  imagerecordbiorecordkey 	
  AND higherTaxonName = 'Plantae'
GROUP BY taxon.taxonKey, taxonName

SELECT taxon.taxonKey, taxonName, COUNT(distinct bioRecordKey)
FROM imageRecord, bioRecord, taxon, higherTaxon
WHERE higherTaxon.taxonKey = taxon.taxonKey
  AND /*bioRecordTaxonKey*/ imageRecordTaxonKey = higherTaxon.taxonKey
  AND bioRecordKey =  imagerecordbiorecordkey 	
  AND higherTaxonName = 'Plantae'
  AND gatheringYear between 1900 and 1950
GROUP BY taxon.taxonKey, taxonName

SELECT taxon.taxonKey, taxonName, COUNT(distinct bioRecordKey) 
FROM imageRecord, bioRecord, taxon, higherTaxon, isoCountry
WHERE higherTaxon.taxonKey = taxon.taxonKey
  AND /*bioRecordTaxonKey*/ imageRecordTaxonKey = higherTaxon.taxonKey
  AND bioRecordKey =  imagerecordbiorecordkey
	AND isoCountryCode = bioRecordCountryCode
	AND countryName = 'UNITED KINGDOM'
	AND higherTaxonName = 'Plantae'
  AND gatheringYear between 1900 and 1950
GROUP BY taxon.taxonKey, taxonName

SELECT taxonKey, taxonName, COUNT(distinct bioRecordKey) 
FROM taxon, bioRecord
WHERE bioRecordTaxonKey = taxonKey
  AND taxonName like 'Ab%'
GROUP BY taxonKey, taxonName

SELECT taxonKey, taxonName, COUNT(distinct bioRecordKey) 
FROM bioRecord, taxon, isoCountry
WHERE bioRecordTaxonKey = taxonKey
	AND isoCountryCode = bioRecordCountryCode
	AND countryName = 'UNITED KINGDOM'
GROUP BY taxonKey, taxonName

update statistics imageRecord