POTD 3: SQL Subqueries

Due 8-October-2026   10-October-2026, 10am
Purpose:

You may make a copy of a worksheet and complete this activity, or simply type your answers in any text editor.

You may work alone or with at most 2 other students (max size=3) in this course.


Import alldbs.sql into your database server (if you have not done so). Write SQL queries to solve the following problems.

Sailor database

Boats (bid, bname, color)
Sailors (sid, sname, rating, age)
Reserves (sid, bid, day)     -- note: no PK
  1. Find the names of the sailors who have reserved a red or green boat. Do not repeat the names of the same sailors.
  2. Find the names of the sailors who have reserved a red boat and a blue boat. Do not repeat the names of the same sailors.

Bank database

account (account_number, branch_name, balance)
borrower (customer_name, loan_number)            -- note: no PK
branch (branch_name, branch_city, assets)
depositor (customer_name, account_number)      -- note: no PK
loan (loan_number, branch_name, amount)  
  1. Find the names of all customers who have a loan, an account, or both from the bank.
  2. Find the names of all customers who have a loan at the Perryridge branch, but no account at any branch in the bank. Do not repeat the name of the same customer.

Grading rubric

[Total: 10 points]: Done (or provide evidence of your attempt, full or reasonable effort)

(-2.5 points) for 24 hours late (submitted after 8-Oct-2026 10am, by 9-Oct-2026 10am)
(-5 points) for 48 hours late (submitted after 9-Oct-2026 10am, by 10-Oct-2026 10am)

(-2.5 points) for 24 hours late (submitted after 10-Oct-2026 10am, by 11-Oct-2026 10am)
(-5 points) for 48 hours late (submitted after 11-Oct-2026 10am, by 12-Oct-2026 10am)


Submission



Copyright © 2026 Upsorn Praphamontripong
Released under the Creative Commons License CC-BY-NC-SA 4.0 license.
Last updated 2026-10-04 19:52