sql playground
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10-31-18.sql 867B

123456789101112131415161718192021222324252627282930313233
  1. -- Show the name and population in millions for the countries of the continent 'South America'.
  2. -- Divide the population by 1000000 to get population in millions.
  3. SELECT name, population/1000000
  4. AS popMillions, continent
  5. FROM world;
  6. -- Show the countries which have a name that includes the word 'United'
  7. SELECT name
  8. FROM countries
  9. WHERE name %like% 'United';
  10. -- Show the countries that are big by area or big by population. Show name, population, and area.
  11. SELECT name, population, area
  12. FROM world
  13. WHERE area > 3000000
  14. OR population > 250000000;
  15. -- For South America, show population
  16. -- not correct
  17. SELECT name, gdp
  18. AS popMillions, gdp/1000000000
  19. FROM world
  20. WHERE continent = 'South America';
  21. -- Show the name and capital where the name and the captial have the same number of characters
  22. SELECT name, capital
  23. FROM world
  24. WHERE length(name) = length(capital)