Exercises
Getting Started
In these exercises we will be using a database of that contains information about Nobel Prizes: nobel_prizes.sqlite. We’ve put up instructions on how to use SQL Manager for Firefox to interact with this database.
The exercises
- Fetch the earliest year recorded in the database.
(Click for our answer)SELECT MIN(Year) FROM Nobel_Prizes; - Fetch the number of records in the database.
(Click for our answer)SELECT COUNT(*) FROM Nobel_Prizes; - Fetch the area, year, and number of awards given out for each area in each year.
(Click for our answer)SELECT Area, Year, COUNT(*) FROM Nobel_Prizes GROUP BY Area, Year; - Fetch the area, and number of awards given out in each area, sorted in ascending order by area.
(Click for our answer)SELECT Area, COUNT(*) FROM Nobel_Prizes GROUP BY Area ORDER BY Area ASC;
- Fetch the area, and number of awards given out in each area, sorted in descending order by number of awards.
(Click for our answer)SELECT Area, COUNT(*) FROM Nobel_Prizes GROUP BY Area ORDER BY Count(*) DESC;
- Fetch the area, and number of awards given out in each area, except for in chemistry.
(Click for our answer)SELECT Area, COUNT(*) FROM Nobel_Prizes WHERE Area != "chemistry" GROUP BY Area;
