# Database: Exercises: SELECT on one table

Name: _________________________________
Write a SELECT statement which produces the results. Put each clause (FROM, WHERE, ...) on a separate line. Assume the table Pet_Owner is defined as follows, but with much more data.

    CREATE TABLE Pet_Owner (
       id          INTEGER,
       first_name  VARCHAR(20),
       last_name   VARCHAR(50),
       title       CHAR(4),  /* Mr, Ms, Miss, or Mrs */
       email       VARCHAR(60),
       dogs        INTEGER,  /* number of dog (pets) */
       cats        INTEGER   /* number of cats */
    );

    INSERT INTO Pet_Owner
      VALUES(1, 'Micky', 'Mouse', 'Mr', 'mickey@disney.com', 1, 0);
    INSERT INTO Pet_Owner
      VALUES(2, 'Bridget', 'Bardot', 'Ms', 'bb@provence.fr', 35, 17);
    INSERT INTO Pet_Owner
      VALUES(3, 'Brenda', 'Beegoode', 'Miss', 'brendab@hotmail.com', NULL, 1);
    INSERT INTO Pet_Owner
      VALUES(4, 'Manatsanan', 'Konthai', 'Miss', NULL, 3, 1);
    . . .

1. List everything in the table.
2. Who is using hotmail (email address ends with @hotmail.com)? Give their name and email addresses only.
3. Who's email is unknown? List them in order by last name, then first name.
4. Who has more cats than dogs? Show their first names (in ascending order) and how many more cats than dogs they have. Extra credit: Show who MIGHT have more cats than dogs by taking into account NULLs.
5. Are there any single (Miss) women with no dogs? List their names and email addresses?