This file contains a set of ten SQL queries designed to retrieve and combine data from various tables within a database likely structured around sales, customers, staff, and products (implied by the table names like sales.orders, sales.customers, production.products). The queries primarily utilize implicit joins (listing tables in the FROM clause and specifying join conditions in the WHERE clause).
The queries focus on:
Retrieving Order Details: Filtering orders by specific staff IDs.
Customer Information: Extracting full names and phone numbers for customers in a specific city (New York).
Joining Staff and Customers: Attempting to retrieve customer and staff information, though Query 3 appears incomplete or incorrectly structured for a functional join, only filtering by staff_id = 2.
Discount Analysis: Identifying staff members who processed orders that included items with a discount greater than 0.05.
Multi-Store Customers: Finding customers who have placed orders in both 'Baldwin Bikes' and 'Santa Cruz Bikes' stores.
Discounted Products: Listing the item ID and product name for items that received a discount greater than 0.05.
Customer Order History: Listing all customers and the shipped date for their corresponding orders.
Staff, Customer, and Order Details: Combining staff name, customer ID, and the order's shipped date.
Staff Order Shipments: Retrieving staff names, customer IDs, and shipped dates, ordered by shipped date.
Comprehensive Order Report: Creating a detailed report linking customer name, order number, order date, and the staff member who processed the order, ordered by order date.