sql4
sql4
2- Display all the languages you have. (Remove redundant data) (457 rows)
select distinct Language
from CountryLanguage
3- Display all countries that lie in Africa sorted by Area. (58 rows)
select *
from Country
where Continent = 'Africa'
order by surfacearea
4- Display all cities that have population more than 2 million. (92 rows)
select *
from City
where [population] > 2000000
5- Display all countries that became independent from 1920 t0 1990. (108 rows)
select *
from Country
where indepyear between 1920 and 1990
7- Display all countries that have any kind of ‘Republic’ government form. (143
rows) select *
from Country
where governmentform like '%Republic%'
8- Display all countries that lie in Asia and have population more than 100 million.
(6 rows)
select *
from Country
where continent = 'Asia' and [population] > 100000000
9- Display country code for all those speak Spanish as an official language. (20
rows)
select countrycode
from CountryLanguage
where [Language] = 'Spanish' and isofficial = 'true'
10- Display country code for all those speak more than 2 languages. (149 rows)
select countrycode
from CountryLanguage
group by countrycode
having count(*) > 2
12- Display all Continents along with the number of countries and total
population in each continent. (7 rows)
select Continent, count(*), sum([population])
from Country
group by Continent
13- You have just discovered a new country, Add it to your database. (Of course,
your country have some cities and languages)
14- In your country, increase life expectation by 5 years.
15- Try to delete your country, what happens?