-- Database schema
| city : ID [ INT ] primary_key , Name [ TEXT ] , CountryCode [ TEXT ] city.CountryCode = country.Code , District [ TEXT ] , Population [ INT ] | sqlite_sequence : name [ TEXT ] , seq [ TEXT ] | country : Code [ TEXT ] primary_key , Name [ TEXT ] , Continent [ TEXT ] , Region [ TEXT ] , SurfaceArea [ INT ] , IndepYear [ INT ] , Population [ INT ] , LifeExpectancy [ INT ] , GNP [ INT ] , GNPOld [ INT ] , LocalName [ TEXT ] , GovernmentForm [ TEXT ] , HeadOfState [ TEXT ] , Capital [ INT ] , Code2 [ TEXT ] | countrylanguage : CountryCode [ TEXT ] primary_key countrylanguage.CountryCode = country.Code , Language [ TEXT ] , IsOfficial [ TEXT ] , Percentage [ INT ] |
-- -- How many official languages are spoken in Afghanistan?

SELECT COUNT(*) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code  =  T2.CountryCode WHERE T1.Name  =  "Afghanistan" AND IsOfficial  =  "T";