Question: SQL Programming I am having trouble writing the correct code, any help would be great. Using subqueries 1. This query uses only the countryLanguage table.
SQL Programming
I am having trouble writing the correct code, any help would be great.
Using subqueries
1. This query uses only the countryLanguage table. Create a query that lists the countrycode, number of distinct languages spoken in that country, along with the % of languages spoken to total languages.
My code so far
SELECT CountryCode, (Count(Language) * 100 / (SELECT COUNT(*) FROM country))AS Language% WHERE country.countrycode=language.countrycode;

This is the instructors output. 
-16 country 15202600-1 . city ID int(11) Name: char(35) CountryCode: char(3) 6 countrylanguage a CountryCode: char(3) a CountryCode char(3) Name:char(52) Continent:char(15) Language:char(30) somci al : enum(TF) Region:char(26) n SurfaceArea:oat(10,2) # Indeprear: smallint(6) n Population: int(11) # Life Expectancy : noat(31) n GNP float 10,2) #GNPOld float(10,2) District: char(20) # Percentage : float(4,1) Population : int11) LocalName: char(45) GovernmentForm: char(45) HeadofState: char(60) # capital : int(11) Code2 : char(2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
