title: How do I query three related tables?
body: <p>I'm new to databases and I'm having a hard time figuring this out. Any assistance would be greatly appreciated</p>
  
  <p>Deliveries Table
  -- ID (PK)
  -- DriverID (FK to Drivers Table)</p>
  
  <p>Drivers Table
  -- ID (PK)
  -- LocationID (FK to Locations Table) </p>
  
  <p>Locations Table
  -- ID (PK)
  -- RestaurantID (FK to Restaurants Table)</p>
  
  <p>Restaurant Table
  --ID (PK)</p>
  
  <p>A Restaurant can have multiple locations (1 to many). A location can have multiple drivers (1 to many). a Driver can have multiple deliveries (1 to many). This design is supposed to break things out in 3rd normal form. So if I want to go to the deliveries table and get all of the deliveries associated with a particular restaurant, how would I query or do a join for that? Would I have to add a second foreign key to Deliveries that directly references the Restaurant table? I think after I see the query I can figure out what is going on. Thx</p>