This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | SELECT * FROM survey | |
| LIMIT 10; | |
| -- What is the number of responses for each question? | |
| SELECT question, COUNT(response) FROM survey | |
| GROUP BY question; | |
| -- The questions 3. Which shapes do you like? and 5. When was your last eye exam? have lower completion rates (80% and 75% respectively). A possible reason might be people don't know which shape fits their face and don't remember when was their last eye exam. | |
| -- Create a new table (structure of the new table is given): | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- How many entries in the countries table are from Africa? | |
| SELECT COUNT(id) FROM countries | |
| WHERE continent = 'Africa'; | |
| --What was the total population of the continent of Oceania in 2005? | |
| SELECT SUM(population) FROM population_years | |
| JOIN countries | |
| ON population_years.country_id = countries.id | |
| WHERE population_years.year = 2005 AND countries.continent = 'Oceania'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | SELECT * FROM met | |
| LIMIT 10; | |
| -- How many pieces are in the American Decorative Art collection? | |
| SELECT COUNT(title) FROM met; | |
| -- Count the number of pieces where the category includes ‘celery’. | |
| SELECT DISTINCT category, COUNT(category) FROM met | |
| WHERE category LIKE '%celery%'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | SELECT * FROM hacker_news | |
| LIMIT 20; | |
| -- What are the top five stories with the highest scores? | |
| SELECT title, score FROM hacker_news | |
| ORDER BY score DESC | |
| LIMIT 5; | |
| -- Is a small percentage of Hacker News submitters taking the majority of the points? | |
| SELECT user, SUM(score) FROM hacker_news | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | SELECT * FROM startups; | |
| -- Calculate the total number of companies in the table: | |
| SELECT COUNT(name) FROM startups; | |
| -- Find the total value of all companies: | |
| SELECT SUM(valuation) FROM startups; | |
| -- Find the highest amount raised by a startup: | |
| SELECT name, MAX(raised) FROM startups; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | SELECT * FROM transaction_data | |
| LIMIT 10; | |
| -- full_names and emails of the transactions listing 20252 as the zip code: | |
| SELECT full_name, email FROM transaction_data | |
| WHERE zip = 20252; | |
| -- Find names and emails associated with ‘Art Vandelay’ for full name or a ‘der’ for their middle name: | |
| SELECT full_name, email FROM transaction_data | |
| WHERE full_name = 'Art Vandelay' OR full_name LIKE '% der %'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- What years are covered by the dataset? | |
| SELECT DISTINCT year FROM population_years; | |
| -- What is the largest population size for Gabon in this dataset? | |
| SELECT * FROM population_years | |
| WHERE country = 'Gabon'; | |
| -- What were the 10 lowest population countries in 2005? | |
| SELECT * FROM population_years | |
| WHERE year = 2005 | 
NewerOlder