BIT 275

Homework due Tuesday October 7, 2010

General Instructions:

Note: There is a bug in SQL Buddy (the software that we use to run queries at so that if two columns have the same name it will only show one of them. For example, if you tried to select the name column from the dog and city tables in the same query only one would show up because they have the same name. This is an SQL Buddy bug. To work around it you’ll need to make sure to use columns aliases (the “AS” clause).

Homework Problems:

  1. Create a query to get an address list for all foster parents including first and last name, address, city, state, and zip code. Sort the list by last name then first name.
  2. Repeat the above query but rename the columns so they look nice. For example, instead of fname the column should be “First Name”. Instead of lname it should be “Last Name”, etc.
  3. Get a list of foster parents and their work phone numbers. For now this list will only include those foster parents that have a work phone number. In the next class we’ll learn how to get a list of all foster parents even if they don’t have a work phone.
  4. Get a list of unique dog names sorted by name. In other words this list should contain every dog name but if there are multiple dogs named “Fido” the name “Fido” should only appear on the list once.
  5. Generate a list with columns containing first name, last name, home phone and work phone for all foster parents. There should be only 1 row per foster parent. For now this table will only contain foster parents that have both a work and a home phone. In the next class we’ll learn how to get a list containing all foster parents.