Home > Articles

Reading with SQL

  • Print
  • + Share This
This chapter is from the book

Exercise Challenge

  1. Write a query that finds all pets older than 10 years.
  2. Write a query to find all people younger than you. Do one that’s older.
  3. Write a query that uses more than one test in the WHERE clause using the AND to write it. For example, WHERE first_name = "Zed" AND age > 30.
  4. Do another query that searches for rows using three columns and uses both AND and OR operators.
  5. This may be a mind-blowing, weird way to look at data if you already know a language like Python or Ruby. Take the time to model the same relationships using classes and objects, then map it to this setup.
  6. Do a query that finds your pets you’ve added thus far.
  7. Change the queries to use your person.id instead of the person.name like I’ve been doing.
  8. Go through the output from your run, and make sure you know what table is produced for which SQL commands and how they produced that output.
  • + Share This
  • 🔖 Save To Your Account