Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SQL Programming I am having trouble writing the correct code, any help would be

ID: 3585154 • Letter: S

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. Create a query that lists the countrycode, number of distinct languages spoken in that country, along with the % of languages spoken to total languages.

-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)

Explanation / Answer

select country code, count(languages), percentage from country, language where country.countrycode=language.countrycode;

You just need to echo the code, count (using the function count) and percentage, where the only condition is the foreign key in language.