CPSC340A
Database Systems

Activity 4

Inner Join

Sales Orders Database

  1. List customers and the dates they placed an order, sorted in order date sequence. (Hint: The solution requires a JOIN of two tables.)

    +------------------+------------+
    | CustomerFullName | OrderDate  |
    +------------------+------------+
    | Sam Abolrous     | 2012-09-01 |
    | David Smith      | 2012-09-01 |
    | Liz Keyser       | 2012-09-01 |
    | Mark Rosales     | 2012-09-01 |
    | Andrew Cencini   | 2012-09-01 |
    | William Thompson | 2012-09-01 |
    | Gary Hallmark    | 2012-09-01 |
    | Suzanne Viescas  | 2012-09-01 |
    | Mariya Sergienko | 2012-09-01 |
    | Suzanne Viescas  | 2012-09-01 |
    | Suzanne Viescas  | 2012-09-02 |
    | Robert Brown     | 2012-09-02 |
    | Luke Patterson   | 2012-09-02 |
    | Alaina Hallmark  | 2012-09-02 |
    | Rachel Patterson | 2012-09-02 |
    | Mark Rosales     | 2012-09-02 |
    | Sam Abolrous     | 2012-09-02 |
    | Joyce Bonnicksen | 2012-09-02 |
    | Jim Wilson       | 2012-09-02 |
    | Mark Rosales     | 2012-09-02 |
    .
    .
    .
    (944 rows)
  2. List employees and the customers for whom they booked an order. (Hint: The solution requires a JOIN of more than two tables.)

    +-------------------+------------------+
    | EmpFullName       | CustFullName     |
    +-------------------+------------------+
    | Ann Patterson     | Liz Keyser       |
    | Ann Patterson     | Robert Brown     |
    | Ann Patterson     | Sam Abolrous     |
    | Ann Patterson     | Dean McCrae      |
    | Ann Patterson     | Suzanne Viescas  |
    | Ann Patterson     | John Viescas     |
    | Ann Patterson     | Mariya Sergienko |
    | Ann Patterson     | Andrew Cencini   |
    | Ann Patterson     | Angel Kennedy    |
    | Ann Patterson     | Rachel Patterson |
    | Ann Patterson     | Maria Patterson  |
    | Ann Patterson     | Luke Patterson   |
    | Ann Patterson     | Mark Rosales     |
    | Ann Patterson     | Darren Gehring   |
    | Ann Patterson     | David Smith      |
    | Ann Patterson     | Kirk DeGrasse    |
    | Ann Patterson     | Manuela Seidel   |
    | Ann Patterson     | Caleb Viescas    |
    | Ann Patterson     | Jim Wilson       |
    | Ann Patterson     | Neil Patterson   |
    | Ann Patterson     | William Thompson |
    | Ann Patterson     | Alaina Hallmark  |
    | Ann Patterson     | Zachary Ehrlich  |
    | Ann Patterson     | Joyce Bonnicksen |
    | Ann Patterson     | Gary Hallmark    |
    | Ann Patterson     | Estella Pundt    |
    | Ann Patterson     | Julia Schnebly   |
    | Mary Thompson     | Sam Abolrous     |
    | Mary Thompson     | Kirk DeGrasse    |
    | Mary Thompson     | Luke Patterson   |
    | Mary Thompson     | Manuela Seidel   |
    .
    .
    .
    (211 rows)
  3. Display all orders, the products in each order, and the amount owed for each product, in order number sequence. (Hint: The solution requires a JOIN of more than two tables.)

    +---------+------------+-----------+---------------------------------------+---------+------+------------+
    | OrderNo | OrderDate  | ProductNo | Product                               | Price   | Qty  | AmountOwed |
    +---------+------------+-----------+---------------------------------------+---------+------+------------+
    |       1 | 2012-09-01 |         6 | Viscount Mountain Bike                |  635.00 |    3 |    1905.00 |
    |       1 | 2012-09-01 |        16 | ProFormance ATB All-Terrain Pedal     |   28.00 |    1 |      28.00 |
    |       1 | 2012-09-01 |        26 | Glide-O-Matic Cycling Helmet          |  121.25 |    5 |     606.25 |
    |       1 | 2012-09-01 |        21 | Dog Ear Aero-Flow Floor Pump          |   55.00 |    3 |     165.00 |
    |       1 | 2012-09-01 |        11 | GT RTS-2 Mountain Bike                | 1650.00 |    4 |    6600.00 |
    |       1 | 2012-09-01 |        40 | Ultimate Export 2G Car Rack           |  174.60 |    6 |    1047.60 |
    |       1 | 2012-09-01 |         1 | Trek 9000 Mountain Bike               | 1200.00 |    2 |    2400.00 |
    |       2 | 2012-09-01 |        27 | X-Pro All Weather Tires               |   24.00 |    4 |      96.00 |
    |       2 | 2012-09-01 |        40 | Ultimate Export 2G Car Rack           |  180.00 |    4 |     720.00 |
    |       3 | 2012-09-01 |        36 | Cosmic Elite Road Warrior Wheels      |  165.00 |    4 |     660.00 |
    |       3 | 2012-09-01 |        11 | GT RTS-2 Mountain Bike                | 1650.00 |    1 |    1650.00 |
    |       3 | 2012-09-01 |        31 | True Grip Competition Gloves          |   21.34 |    5 |     106.70 |
    |       3 | 2012-09-01 |         1 | Trek 9000 Mountain Bike               | 1164.00 |    5 |    5820.00 |
    |       3 | 2012-09-01 |         6 | Viscount Mountain Bike                |  615.95 |    5 |    3079.75 |
    |       3 | 2012-09-01 |        16 | ProFormance ATB All-Terrain Pedal     |   28.00 |    2 |      56.00 |
    |       3 | 2012-09-01 |        26 | Glide-O-Matic Cycling Helmet          |  125.00 |    3 |     375.00 |
    .
    .
    .
    (3973 rows)
  4. Show me the vendors and the products they supply to us for products that cost less than $100. (Hint: The solution requires a JOIN of more than two tables.)

    +------------------------+---------------------------------------+----------------+
    | VendName               | ProductName                           | WholesalePrice |
    +------------------------+---------------------------------------+----------------+
    | Shinoman, Incorporated | Shinoman 105 SC Brakes                |          14.51 |
    | Shinoman, Incorporated | Shinoman Dura-Ace Headset             |          41.68 |
    | Shinoman, Incorporated | Shinoman Deluxe TX-30 Pedal           |          27.79 |
    | Viscount               | Viscount C-500 Wireless Bike Computer |          31.12 |
    | Viscount               | Viscount Microshell Helmet            |          22.86 |
    | Viscount               | Viscount Tru-Beat Heart Transmitter   |          29.84 |
    | Nikoma of America      | Nikoma Lok-Tight U-Lock               |          21.53 |
    | Nikoma of America      | Glide-O-Matic Cycling Helmet          |          81.56 |
    | Nikoma of America      | X-Pro All Weather Tires               |          15.66 |
    | Nikoma of America      | Turbo Twin Tires                      |          18.92 |
    | ProFormance            | ProFormance Toe-Klips 2G              |           3.34 |
    | ProFormance            | ProFormance ATB All-Terrain Pedal     |          18.76 |
    .
    .
    .
    (66 rows)
  5. Show me customers and employees who have the same last name. (Hint: The solution requires a JOIN on matching values.)

    +------------------+-------------------+
    | CustFullName     | EmpFullName       |
    +------------------+-------------------+
    | Suzanne Viescas  | Carol Viescas     |
    | Suzanne Viescas  | David Viescas     |
    | William Thompson | Mary Thompson     |
    | John Viescas     | Carol Viescas     |
    | John Viescas     | David Viescas     |
    | Neil Patterson   | Ann Patterson     |
    | Neil Patterson   | Kathryn Patterson |
    | Rachel Patterson | Ann Patterson     |
    | Rachel Patterson | Kathryn Patterson |
    | Caleb Viescas    | Carol Viescas     |
    | Caleb Viescas    | David Viescas     |
    | Maria Patterson  | Ann Patterson     |
    | Maria Patterson  | Kathryn Patterson |
    | Kirk DeGrasse    | Kirk DeGrasse     |
    | Luke Patterson   | Ann Patterson     |
    | Luke Patterson   | Kathryn Patterson |
    +------------------+-------------------+
    (16 rows)
  6. Show me customers and employees who live in the same city. (Hint: The solution requires a JOIN on matching values.)

    +---------------+--------------+--------------+-------------+-------------+
    | CustFirstName | CustLastName | EmpFirstName | EmpLastName | EmpCity     |
    +---------------+--------------+--------------+-------------+-------------+
    | Suzanne       | Viescas      | David        | Viescas     | Redmond     |
    | William       | Thompson     | Mary         | Thompson    | Duvall      |
    | Gary          | Hallmark     | Ann          | Patterson   | Auburn      |
    | Dean          | McCrae       | David        | Viescas     | Redmond     |
    | John          | Viescas      | David        | Viescas     | Redmond     |
    | Andrew        | Cencini      | Kathryn      | Patterson   | Seattle     |
    | Liz           | Keyser       | Susan        | McLain      | Bellevue    |
    | Joyce         | Bonnicksen   | Susan        | McLain      | Bellevue    |
    | Julia         | Schnebly     | Kathryn      | Patterson   | Seattle     |
    | Kirk          | DeGrasse     | Kirk         | DeGrasse    | San Antonio |
    +---------------+--------------+--------------+-------------+-------------+
    (10 rows)

Entertainment Agency Database

  1. Display agents and the engagement dates they booked, sorted by booking start date. (Hint: The solution requires a JOIN of two tables.)

    +------------------+------------+
    | AgtFullName      | StartDate  |
    +------------------+------------+
    | Karen Smith      | 2012-09-01 |
    | Carol Viescas    | 2012-09-10 |
    | Caleb Viescas    | 2012-09-10 |
    | Carol Viescas    | 2012-09-11 |
    | Karen Smith      | 2012-09-11 |
    | Marianne Wier    | 2012-09-11 |
    | Karen Smith      | 2012-09-15 |
    | Carol Viescas    | 2012-09-17 |
    | William Thompson | 2012-09-17 |
    | Scott Bishop     | 2012-09-18 |
    | Carol Viescas    | 2012-09-18 |
    | Maria Patterson  | 2012-09-18 |
    | William Thompson | 2012-09-24 |
    | William Thompson | 2012-09-24 |
    | Maria Patterson  | 2012-09-29 |
    | Maria Patterson  | 2012-09-29 |
    | Karen Smith      | 2012-09-30 |
    | Marianne Wier    | 2012-09-30 |
    | William Thompson | 2012-09-30 |
    | Karen Smith      | 2012-10-01 |
    | Marianne Wier    | 2012-10-02 |
    | Karen Smith      | 2012-10-06 |
    | Marianne Wier    | 2012-10-06 |
    | Caleb Viescas    | 2012-10-07 |
    | Maria Patterson  | 2012-10-07 |
    | Caleb Viescas    | 2012-10-07 |
    | John Kennedy     | 2012-10-09 |
    | Carol Viescas    | 2012-10-13 |
    | Carol Viescas    | 2012-10-13 |
    | Karen Smith      | 2012-10-14 |
    | Maria Patterson  | 2012-10-14 |
    | Maria Patterson  | 2012-10-14 |
    | William Thompson | 2012-10-20 |
    | Carol Viescas    | 2012-10-20 |
    | Maria Patterson  | 2012-10-21 |
    | William Thompson | 2012-10-21 |
    | Carol Viescas    | 2012-10-22 |
    .
    .
    .
    (111 rows)
  2. List customers and the entertainers they booked. (Hint: The solution requires a JOIN of more than two tables.)

    +--------------------+--------------------------+
    | CustFullName       | EntStageName             |
    +--------------------+--------------------------+
    | Mark Rosales       | Carol Peacock Trio       |
    | Doris Hartwig      | Carol Peacock Trio       |
    | Elizabeth Hallmark | Carol Peacock Trio       |
    | Zachary Ehrlich    | Carol Peacock Trio       |
    | Matt Berg          | Carol Peacock Trio       |
    | Dean McCrae        | Carol Peacock Trio       |
    | Estella Pundt      | Carol Peacock Trio       |
    | Dean McCrae        | Topazz                   |
    | Doris Hartwig      | Topazz                   |
    | Estella Pundt      | Topazz                   |
    | Elizabeth Hallmark | Topazz                   |
    | Matt Berg          | JV & the Deep Six        |
    | Elizabeth Hallmark | JV & the Deep Six        |
    | Carol Viescas      | JV & the Deep Six        |
    | Deb Waldal         | JV & the Deep Six        |
    | Mark Rosales       | JV & the Deep Six        |
    | Zachary Ehrlich    | JV & the Deep Six        |
    | Doris Hartwig      | JV & the Deep Six        |
    | Matt Berg          | Jim Glynn                |
    | Liz Keyser         | Jim Glynn                |
    | Sarah Thompson     | Jim Glynn                |
    | Zachary Ehrlich    | Jim Glynn                |
    | Kerry Patterson    | Jim Glynn                |
    | Doris Hartwig      | Jazz Persuasion          |
    | Dean McCrae        | Jazz Persuasion          |
    | Peter Brehm        | Jazz Persuasion          |
    | Sarah Thompson     | Jazz Persuasion          |
    | Zachary Ehrlich    | Jazz Persuasion          |
    | Peter Brehm        | Modern Dance             |
    | Estella Pundt      | Modern Dance             |
    | Zachary Ehrlich    | Modern Dance             |
    | Elizabeth Hallmark | Modern Dance             |
    | Matt Berg          | Modern Dance             |
    | Carol Viescas      | Modern Dance             |
    | Dean McCrae        | Modern Dance             |
    | Sarah Thompson     | Modern Dance             |
    | Matt Berg          | Coldwater Cattle Company |
    .
    .
    .
    (75 rows)
  3. Find the agents and entertainers who live in the same postal code. (Hint: The solution requires a JOIN on matching values.)

    +-----------------+--------------------+------------+
    | AgtFullName     | EntStageName       | AgtZipCode |
    +-----------------+--------------------+------------+
    | Scott Bishop    | Country Feeling    | 98125      |
    | Scott Bishop    | Saturday Revue     | 98125      |
    | Carol Viescas   | Susan McLain       | 98006      |
    | Karen Smith     | Country Feeling    | 98125      |
    | Karen Smith     | Saturday Revue     | 98125      |
    | John Kennedy    | Country Feeling    | 98125      |
    | John Kennedy    | Saturday Revue     | 98125      |
    | Caleb Viescas   | Carol Peacock Trio | 98052      |
    | Caleb Viescas   | JV & the Deep Six  | 98052      |
    | Maria Patterson | Susan McLain       | 98006      |
    +-----------------+--------------------+------------+
    (10 rows)

School Scheduling Database

  1. Display buildings and all the classrooms in each building. (Hint: The solution requires a JOIN of two tables.)

    +------------------------+-------------+
    | BuildingName           | ClassRoomID |
    +------------------------+-------------+
    | Arts and Sciences      |        1514 |
    | Arts and Sciences      |        1515 |
    | Arts and Sciences      |        1519 |
    | Arts and Sciences      |        1525 |
    | Arts and Sciences      |        1530 |
    | Arts and Sciences      |        1532 |
    | Arts and Sciences      |        1619 |
    | Arts and Sciences      |        1622 |
    | Arts and Sciences      |        1624 |
    | Arts and Sciences      |        1627 |
    | College Center         |        2357 |
    | College Center         |        3343 |
    | College Center         |        3345 |
    | College Center         |        3346 |
    | College Center         |        3352 |
    | College Center         |        3353 |
    | College Center         |        3355 |
    | College Center         |        3443 |
    | College Center         |        3445 |
    | College Center         |        3446 |
    | College Center         |        3452 |
    | College Center         |        3455 |
    | Instructional Building |        2408 |
    | Instructional Building |        2423 |
    | Instructional Building |        3305 |
    | Instructional Building |        3307 |
    | Instructional Building |        3309 |
    | Instructional Building |        3313 |
    | Instructional Building |        3315 |
    | Instructional Building |        3317 |
    | Instructional Building |        3319 |
    | Instructional Building |        3322 |
    | Instructional Building |        3330 |
    | Instructional Building |        3404 |
    | Instructional Building |        3406 |
    | Instructional Building |        3409 |
    | Instructional Building |        3415 |
    | Instructional Building |        3420 |
    | Instructional Building |        3422 |
    | Instructional Building |        3431 |
    | Library                |        1131 |
    | Library                |        1142 |
    | Library                |        1231 |
    | Technology Building    |        1639 |
    | Technology Building    |        1640 |
    | Technology Building    |        1641 |
    | Technology Building    |        1642 |
    +------------------------+-------------+
    (47 rows)

s2. List students and all the classes in which they are currently enrolled. (Hint: The solution requires a JOIN of more than two tables.)

    +---------------------+---------+--------------------------------------------+
    | StudentFullName     | ClassID | SubjectName                                |
    +---------------------+---------+--------------------------------------------+
    | Patterson, Kerry    |    4180 | Composition - Intermediate                 |
    | Patterson, Kerry    |    5917 | Intermediate Algebra                       |
    | Patterson, Kerry    |    6082 | U.S. History Since 1865                    |
    | Stadick, Betsy      |    4180 | Composition - Intermediate                 |
    | Stadick, Betsy      |    4560 | Second Year Music Theory                   |
    | Stadick, Betsy      |    6082 | U.S. History Since 1865                    |
    | Galvin, Janice      |    4020 | Computer Art                               |
    | Galvin, Janice      |    4180 | Composition - Intermediate                 |
    | Galvin, Janice      |    5430 | Problem Solving and Structured Programming |
    | Galvin, Janice      |    6082 | U.S. History Since 1865                    |
    | Hartwig, Doris      |    4196 | Advanced English Grammar                   |
    | Hartwig, Doris      |    5510 | Financial Accounting Fundamentals II       |
    | Hartwig, Doris      |    5917 | Intermediate Algebra                       |
    | Bishop, Scott       |    4002 | Design                                     |
    | Bishop, Scott       |    4180 | Composition - Intermediate                 |
    | Bishop, Scott       |    5907 | Elementary Algebra                         |
    | Hallmark, Elizabeth |    4196 | Advanced English Grammar                   |
    | Hallmark, Elizabeth |    5071 | Survey Of Physics                          |
    | Hallmark, Elizabeth |    5933 | Intermediate Algebra                       |
    | Sheskey, Sara       |    4180 | Composition - Intermediate                 |
    | Sheskey, Sara       |    5917 | Intermediate Algebra                       |
    | Sheskey, Sara       |    6082 | U.S. History Since 1865                    |
    | Smith, Karen        |    4183 | Composition - Intermediate                 |
    | Smith, Karen        |    4196 | Advanced English Grammar                   |
    | Smith, Karen        |    6030 | Survey of Economics                        |
    | Kennedy, John       |    4180 | Composition - Intermediate                 |
    | Kennedy, John       |    5430 | Problem Solving and Structured Programming |
    | Kennedy, John       |    6082 | U.S. History Since 1865                    |
    | Thompson, Sarah     |    4196 | Advanced English Grammar                   |
    | Thompson, Sarah     |    5510 | Financial Accounting Fundamentals II       |
    | Thompson, Sarah     |    5917 | Intermediate Algebra                       |
    | Viescas, Michael    |    4002 | Design                                     |
    | Viescas, Michael    |    4180 | Composition - Intermediate                 |
    | Viescas, Michael    |    5907 | Elementary Algebra                         |
    | Bonnicksen, Kendra  |    4196 | Advanced English Grammar                   |
    | Bonnicksen, Kendra  |    5071 | Survey Of Physics                          |
    | Bonnicksen, Kendra  |    5933 | Intermediate Algebra                       |
    | Jones, Brannon      |    4183 | Composition - Intermediate                 |
    | Jones, Brannon      |    4196 | Advanced English Grammar                   |
    | Jones, Brannon      |    6030 | Survey of Economics                        |
    | Pundt, Steve        |    4020 | Computer Art                               |
    | Pundt, Steve        |    4180 | Composition - Intermediate                 |
    | Pundt, Steve        |    5430 | Problem Solving and Structured Programming |
    | Pundt, Steve        |    6082 | U.S. History Since 1865                    |
    | Chavez, George      |    4002 | Design                                     |
    | Chavez, George      |    4180 | Composition - Intermediate                 |
    | Chavez, George      |    5907 | Elementary Algebra                         |
    | Lum, Richard        |    4196 | Advanced English Grammar                   |
    | Lum, Richard        |    5071 | Survey Of Physics                          |
    | Lum, Richard        |    5933 | Intermediate Algebra                       |
    +---------------------+---------+--------------------------------------------+
(50 rows)
  1. List the faculty staff and the subject each teaches. (Hint: The solution requires a JOIN of more than two tables.)

    +--------------------+--------------------------------------------+
    | StfFullName        | SubjectName                                |
    +--------------------+--------------------------------------------+
    | Viescas, Suzanne   | Design                                     |
    | Viescas, Suzanne   | Art History                                |
    | Viescas, Suzanne   | First Year Theory and Ear Training         |
    | Viescas, Suzanne   | History of Jazz                            |
    | Viescas, Suzanne   | Composition - Intermediate                 |
    | Hallmark, Gary     | Financial Accounting Fundamentals II       |
    | Hallmark, Gary     | Business Tax Accounting                    |
    | Hallmark, Gary     | Painting                                   |
    | Hallmark, Gary     | Information Systems Concepts               |
    | Hallmark, Gary     | Elementary Algebra                         |
    | Smith, Jeffrey     | Financial Accounting Fundamentals II       |
    | Smith, Jeffrey     | Business Tax Accounting                    |
    | Smith, Jeffrey     | Information Systems Concepts               |
    | Smith, Jeffrey     | Geometry and Visualization                 |
    | Patterson, Ann     | Composition - Intermediate                 |
    | Patterson, Ann     | U.S. History to 1877                       |
    | Patterson, Ann     | Trigonometry                               |
    | Brown, Robert      | Financial Accounting Fundamentals I        |
    | Brown, Robert      | Intermediate Accounting                    |
    | Brown, Robert      | Principles of Economics: Macroeconomics    |
    | Brown, Robert      | Preparatory Mathematics                    |
    | Waldal, Deb        | Microcomputer Applications                 |
    | Waldal, Deb        | Database Management                        |
    | Waldal, Deb        | Programming in BASIC                       |
    | Waldal, Deb        | Computer Programming                       |
    | Waldal, Deb        | Elementary Algebra                         |
    | Brehm, Peter       | Introduction to Art                        |
    | Brehm, Peter       | Computer Art                               |
    | Brehm, Peter       | Advanced English Grammar                   |
    | Brehm, Peter       | World History to 1500                      |
    | Brehm, Peter       | U.S. History Since 1865                    |
    | Sergienko, Mariya  | Drawing                                    |
    | Sergienko, Mariya  | Principles of Economics: Macroeconomics    |
    | Sergienko, Mariya  | Intermediate Algebra                       |
    | Glynn, Jim         | Chemistry                                  |
    | Glynn, Jim         | Organic Chemistry                          |
    | Glynn, Jim         | Problem Solving and Structured Programming |
    | Glynn, Jim         | Survey Of Physics                          |
    | Glynn, Jim         | Engineering Physics I                      |
    | Viescas, Carol     | Fundamentals of Managerial Accounting      |
    | Viescas, Carol     | Developing A Feasibility Plan              |
    | Viescas, Carol     | Information Technology I                   |
    | Viescas, Carol     | Intermediate Algebra                       |
    | Hallmark, Alaina   | Introduction to Art                        |
    | Hallmark, Alaina   | Computer Art                               |
    | Hallmark, Alaina   | Music in the Western World                 |
    | Hallmark, Alaina   | Second Year Music Theory                   |
    | Hallmark, Alaina   | Advanced English Grammar                   |
    | Keyser, Liz        | Painting                                   |
    | Keyser, Liz        | Survey of Economics                        |
    | Keyser, Liz        | World History to 1500                      |
    | Keyser, Liz        | U.S. History Since 1865                    |
    | Keyser, Liz        | Geometry and Visualization                 |
    | Abolrous, Sam      | Design                                     |
    | Abolrous, Sam      | Art History                                |
    | Abolrous, Sam      | First Year Theory and Ear Training         |
    | Abolrous, Sam      | History of Jazz                            |
    | Wilson, Jim        | Problem Solving and Structured Programming |
    | Wilson, Jim        | Programming in BASIC                       |
    | Wilson, Jim        | Computer Programming                       |
    | Wilson, Jim        | Preparatory Mathematics                    |
    | Smith, David       | Principles of Economics: Microeconomics    |
    | Smith, David       | Introduction to Geography                  |
    | Smith, David       | Physical Geography                         |
    | Smith, David       | American Government                        |
    | Smith, David       | Women and Politics                         |
    | Hernandez, Michael | Drawing                                    |
    | Hernandez, Michael | Microcomputer Applications                 |
    | Hernandez, Michael | Database Management                        |
    | Hernandez, Michael | Music in the Western World                 |
    | Hernandez, Michael | Second Year Music Theory                   |
    | Bonnicksen, Joyce  | Developing A Feasibility Plan              |
    | Bonnicksen, Joyce  | Information Technology I                   |
    | Bonnicksen, Joyce  | Survey of Economics                        |
    | Bonnicksen, Joyce  | Introduction to Political Science          |
    | Bonnicksen, Joyce  | American Government                        |
    | Ehrlich, Katherine | Biological Principles                      |
    | Ehrlich, Katherine | General Biology                            |
    | Ehrlich, Katherine | Fundamentals of Chemistry                  |
    | Ehrlich, Katherine | Survey Of Physics                          |
    | Ehrlich, Katherine | Engineering Physics I                      |
    | Viescas, Caleb     | General Biology                            |
    | Viescas, Caleb     | Microbiology                               |
    | Viescas, Caleb     | Fundamentals of Chemistry                  |
    | Viescas, Caleb     | General Physics                            |
    | Viescas, Caleb     | Engineering Physics II                     |
    | Black, Alastair    | Fundamentals of Managerial Accounting      |
    | Black, Alastair    | Introduction to Business                   |
    | Black, Alastair    | Introduction to Entrepreneurship           |
    | Black, Alastair    | Information Technology II                  |
    | Black, Alastair    | Composition - Fundamentals                 |
    | Patterson, Maria   | Principles of Economics: Microeconomics    |
    | Patterson, Maria   | U.S. History to 1877                       |
    | Patterson, Maria   | Introduction to Political Science          |
    | Patterson, Maria   | Women and Politics                         |
    | Coie, Caroline     | Financial Accounting Fundamentals I        |
    | Coie, Caroline     | Intermediate Accounting                    |
    | Coie, Caroline     | Introduction to Business                   |
    | Coie, Caroline     | Introduction to Entrepreneurship           |
    | Coie, Caroline     | Information Technology II                  |
    | Coie, Caroline     | Trigonometry                               |
    | DeGrasse, Kirk     | Biological Principles                      |
    | DeGrasse, Kirk     | Microbiology                               |
    | DeGrasse, Kirk     | Chemistry                                  |
    | DeGrasse, Kirk     | Organic Chemistry                          |
    | DeGrasse, Kirk     | General Physics                            |
    | DeGrasse, Kirk     | Engineering Physics II                     |
    | Patterson, Luke    | Composition - Fundamentals                 |
    | Patterson, Luke    | Introduction to Geography                  |
    | Patterson, Luke    | Physical Geography                         |
    +--------------------+--------------------------------------------+
    (110 rows)
  2. Show me the students who have a grade of 85 or better in art and who also have a grade of 85 or better in any computer course. (Hint: The solution requires a JOIN on matching values.)

    +---------------+
    | StudFullName  |
    +---------------+
    | Kennedy, John |
    +---------------+
    (1 row)

Bowling League Database

  1. List the bowling teams and all the team members. (Hint: The solution requires a JOIN of two tables.)

    +------------+---------------------+
    | TeamName   | BowlerFullName      |
    +------------+---------------------+
    | Marlins    | Fournier, Barbara   |
    | Marlins    | Fournier, David     |
    | Marlins    | Kennedy, John       |
    | Marlins    | Sheskey, Sara       |
    | Sharks     | Patterson, Ann      |
    | Sharks     | Patterson, Neil     |
    | Sharks     | Viescas, David      |
    | Sharks     | Viescas, Stephanie  |
    | Terrapins  | Black, Alastair     |
    | Terrapins  | Cunningham, David   |
    | Terrapins  | Kennedy, Angel      |
    | Terrapins  | Viescas, Carol      |
    | Barracudas | Hallmark, Elizabeth |
    | Barracudas | Hallmark, Gary      |
    | Barracudas | Patterson, Kathryn  |
    | Barracudas | Sheskey, Richard    |
    | Dolphins   | Hernandez, Kendra   |
    | Dolphins   | Hernandez, Michael  |
    | Dolphins   | Viescas, John       |
    | Dolphins   | Viescas, Suzanne    |
    | Orcas      | Ehrlich, Zachary    |
    | Orcas      | Hallmark, Alaina    |
    | Orcas      | Viescas, Caleb      |
    | Orcas      | Thompson, Sarah     |
    | Manatees   | Patterson, Megan    |
    | Manatees   | Thompson, Mary      |
    | Manatees   | Thompson, William   |
    | Manatees   | Viescas, Michael    |
    | Swordfish  | Hallmark, Bailey    |
    | Swordfish  | Patterson, Rachel   |
    | Swordfish  | Pundt, Steve        |
    | Swordfish  | Rosales, Joe        |
    +------------+---------------------+
    (32 rows)
  2. Display the bowlers, the matches they played in, and the bowler game scores. (Hint: The solution requires a JOIN of more than two tables.)

    +---------+------------+--------------------+------------+----------+
    | MatchID | TeamName   | BowlerFullName     | GameNumber | RawScore |
    +---------+------------+--------------------+------------+----------+
    |       1 | Marlins    | Barbara Fournier   |          1 |      146 |
    |       1 | Marlins    | Barbara Fournier   |          2 |      146 |
    |       1 | Marlins    | Barbara Fournier   |          3 |      153 |
    |       5 | Marlins    | Barbara Fournier   |          1 |      145 |
    |       5 | Marlins    | Barbara Fournier   |          2 |      137 |
    |       5 | Marlins    | Barbara Fournier   |          3 |      152 |
    |      10 | Marlins    | Barbara Fournier   |          1 |      140 |
    |      10 | Marlins    | Barbara Fournier   |          2 |      137 |
    |      10 | Marlins    | Barbara Fournier   |          3 |      161 |
    |      13 | Marlins    | Barbara Fournier   |          1 |      159 |
    |      13 | Marlins    | Barbara Fournier   |          2 |      140 |
    |      13 | Marlins    | Barbara Fournier   |          3 |      158 |
    |      17 | Marlins    | Barbara Fournier   |          1 |      139 |
    |      17 | Marlins    | Barbara Fournier   |          2 |      164 |
    |      17 | Marlins    | Barbara Fournier   |          3 |      161 |
    |      21 | Marlins    | Barbara Fournier   |          1 |      141 |
    |      21 | Marlins    | Barbara Fournier   |          2 |      141 |
    |      21 | Marlins    | Barbara Fournier   |          3 |      139 |
    |      25 | Marlins    | Barbara Fournier   |          1 |      149 |
    |      25 | Marlins    | Barbara Fournier   |          2 |      159 |
    |      25 | Marlins    | Barbara Fournier   |          3 |      138 |
    |      29 | Marlins    | Barbara Fournier   |          1 |      161 |
    |      29 | Marlins    | Barbara Fournier   |          2 |      141 |
    |      29 | Marlins    | Barbara Fournier   |          3 |      156 |
    |      34 | Marlins    | Barbara Fournier   |          1 |      140 |
    |      34 | Marlins    | Barbara Fournier   |          2 |      140 |
    |      34 | Marlins    | Barbara Fournier   |          3 |      149 |
    |      37 | Marlins    | Barbara Fournier   |          1 |      143 |
    |      37 | Marlins    | Barbara Fournier   |          2 |      156 |
    |      37 | Marlins    | Barbara Fournier   |          3 |      151 |
    |      41 | Marlins    | Barbara Fournier   |          1 |      143 |
    |      41 | Marlins    | Barbara Fournier   |          2 |      156 |
    |      41 | Marlins    | Barbara Fournier   |          3 |      142 |
    |      45 | Marlins    | Barbara Fournier   |          1 |      164 |
    |      45 | Marlins    | Barbara Fournier   |          2 |      153 |
    |      45 | Marlins    | Barbara Fournier   |          3 |      163 |
    |      49 | Marlins    | Barbara Fournier   |          1 |      142 |
    |      49 | Marlins    | Barbara Fournier   |          2 |      145 |
    |      49 | Marlins    | Barbara Fournier   |          3 |      140 |
    |      53 | Marlins    | Barbara Fournier   |          1 |      139 |
    |      53 | Marlins    | Barbara Fournier   |          2 |      155 |
    |      53 | Marlins    | Barbara Fournier   |          3 |      158 |
    |       1 | Marlins    | David Fournier     |          1 |      166 |
    |       1 | Marlins    | David Fournier     |          2 |      135 |
    .
    .
    .
    (1344 rows)
  3. Find the bowlers who live in the same ZIP Code. (Hint: The solution requires a JOIN on matching values.)

    +---------------------+-----------+---------------------+
    | FirstBowler         | BowlerZip | SecondBowler        |
    +---------------------+-----------+---------------------+
    | Fournier, David     | 98123     | Fournier, Barbara   |
    | Fournier, Barbara   | 98123     | Fournier, David     |
    | Kennedy, Angel      | 98099     | Kennedy, John       |
    | Sheskey, Richard    | 98011     | Sheskey, Sara       |
    | Patterson, Neil     | 98002     | Patterson, Ann      |
    | Patterson, Kathryn  | 98002     | Patterson, Ann      |
    | Patterson, Megan    | 98002     | Patterson, Ann      |
    | Patterson, Rachel   | 98002     | Patterson, Ann      |
    | Patterson, Ann      | 98002     | Patterson, Neil     |
    | Patterson, Kathryn  | 98002     | Patterson, Neil     |
    | Patterson, Megan    | 98002     | Patterson, Neil     |
    | Patterson, Rachel   | 98002     | Patterson, Neil     |
    | Viescas, Stephanie  | 98052     | Viescas, David      |
    | Cunningham, David   | 98052     | Viescas, David      |
    | Viescas, John       | 98052     | Viescas, David      |
    | Viescas, Suzanne    | 98052     | Viescas, David      |
    | Viescas, Caleb      | 98052     | Viescas, David      |
    | Viescas, Michael    | 98052     | Viescas, David      |
    | Viescas, David      | 98052     | Viescas, Stephanie  |
    | Cunningham, David   | 98052     | Viescas, Stephanie  |
    | Viescas, John       | 98052     | Viescas, Stephanie  |
    | Viescas, Suzanne    | 98052     | Viescas, Stephanie  |
    | Viescas, Caleb      | 98052     | Viescas, Stephanie  |
    | Viescas, Michael    | 98052     | Viescas, Stephanie  |
    | Viescas, David      | 98052     | Cunningham, David   |
    | Viescas, Stephanie  | 98052     | Cunningham, David   |
    | Viescas, John       | 98052     | Cunningham, David   |
    | Viescas, Suzanne    | 98052     | Cunningham, David   |
    | Viescas, Caleb      | 98052     | Cunningham, David   |
    | Viescas, Michael    | 98052     | Cunningham, David   |
    | Kennedy, John       | 98099     | Kennedy, Angel      |
    | Hallmark, Gary      | 98072     | Hallmark, Elizabeth |
    | Hallmark, Alaina    | 98072     | Hallmark, Elizabeth |
    | Hallmark, Bailey    | 98072     | Hallmark, Elizabeth |
    | Hallmark, Elizabeth | 98072     | Hallmark, Gary      |
    | Hallmark, Alaina    | 98072     | Hallmark, Gary      |
    | Hallmark, Bailey    | 98072     | Hallmark, Gary      |
    .
    .
    .
    (92 rows)

Recipes Database

  1. List all the recipes for salads. (Hint: The solution requires a JOIN of two tables.)

    +---------------------+
    | RecipeTitle         |
    +---------------------+
    | Mike's Summer Salad |
    +---------------------+
    (1 row)
  2. List all recipes that contain a dairy ingredient. (Hint: The solution requires a JOIN of more than two tables.)

    +--------------------+
    | RecipeTitle        |
    +--------------------+
    | Fettuccini Alfredo |
    | Yorkshire Pudding  |
    +--------------------+
    (2 rows)
  3. Find the ingredients that use the same default measurement amount. (Hint: The solution requires a JOIN on matching values.)

    +-------------------------------+------------------------+-------------------------------+
    | FirstIngredientName           | MeasurementDescription | SecondIngredientName          |
    +-------------------------------+------------------------+-------------------------------+
    | Water                         | Ounce                  | Beef                          |
    | Guinness Beer                 | Ounce                  | Beef                          |
    | Vinegar                       | Ounce                  | Beef                          |
    | Olive Oil                     | Ounce                  | Beef                          |
    | Fettuccini Pasta              | Ounce                  | Beef                          |
    | Heavy Cream                   | Ounce                  | Beef                          |
    | Spaghetti                     | Ounce                  | Beef                          |
    | Mustard, Regular              | Ounce                  | Beef                          |
    | Mustard, Dijon                | Ounce                  | Beef                          |
    | Ketchup                       | Ounce                  | Beef                          |
    | Salsa                         | Ounce                  | Beef                          |
    | Parmesan Cheese               | Ounce                  | Beef                          |
    | Blue Cheese                   | Ounce                  | Beef                          |
    | White Pepper (ground)         | Ounce                  | Beef                          |
    | Cayenne Pepper, Ground        | Ounce                  | Beef                          |
    | Balsamic Vinaigrette Dressing | Ounce                  | Beef                          |
    | Red Snapper                   | Ounce                  | Beef                          |
    | Beef                          | Ounce                  | Water                         |
    | Guinness Beer                 | Ounce                  | Water                         |
    | Vinegar                       | Ounce                  | Water                         |
    | Olive Oil                     | Ounce                  | Water                         |
    | Fettuccini Pasta              | Ounce                  | Water                         |
    | Heavy Cream                   | Ounce                  | Water                         |
    | Spaghetti                     | Ounce                  | Water                         |
    .
    .
    .
    (628 rows)
  4. Show me the recipes that have beef and garlic. (Hint: The solution requires a JOIN on matching values.)

    +-------------+
    | RecipeTitle |
    +-------------+
    | Roast Beef  |
    +-------------+
    (1 row)