Basic Select Statement

The following query can be written in several ways. Write at least two versions of the query.

  1. List in alphabetical order, the last and first names of all authors who live in NY, NJ or CT and whose last name starts with a letter from 'A' through 'M', Write this query in two different ways (I can think of a number of different ways).

The following queries are similar to the first one. You only have to write one version for each of the following.

  1. List in alphabetical order, the last and first names of all authors who live in NY, NJ or CT and whose last name starts with a letter from 'N' through 'Z'.

  2. List in alphabetical order, the last and first names of all authors who live in any state other than NY, NJ and CT and whose last name starts with a letter from 'A' through 'M'.

  3. List in alphabetical order, the last and first names of all authors who live in any state other than NY, NJ and CT and whose last name starts with a letter from 'N' through 'Z'.


  1. List in alphabetical order, the last and first names of all authors whose first and last names start with the same letter. Hint: use the substring function.

  2. List in alphabetical order, the last and first names of all authors whose first and last names are each at least 4 letters long. Hint you can approach this in one of two ways. Either (1) use the len function OR (2) use the LIKE keyword

  3. Create one column which contains the first 8 letters (all in lowercase) of the concatenation of the first and last names of each author. For example, if an author's name is Joe Schwartzenberg the query should display "joeschwa". Hint: use the + concatenation operator together with the substring and lower functions.

  4. Redo the previous query but only show people whose name gets truncated (i.e. "chopped off"). Hint: use the LEN function.

Group By

  1. List only the "last name" of the author that would appear first in alphabetical list of names of all authors.
  2. Do the same as the previous query but show the first "last name" for authors in NY, NJ and CT.
  3. List the number of books and the average number of pages for each type of book (e.g. 3 72 history, 5 150 biography, etc. )
  4. List the number of books for each type of book where there are more than 2 of that type.
  5. List the longest and shortest page length for books of each type that were published in the year 2000 or later.