Using the description of the database below, name and discuss a few SQL queries that would allow
Question:
Using the description of the database below, name and discuss a few SQL queries that would allow you to retrieve data from the database tables.
**Database Name:** ECommerceDB
**Tables:**
1. **Products**
- **Fields:**
- ProductID (Primary Key)
- ProductName
- Description
- Price
- StockQuantity
- CategoryID (Foreign Key)
This table stores information about the products available for sale. The ProductID uniquely identifies each product. Each product is associated with a category indicated by the CategoryID, creating a one-to-many relationship between Categories and Products.
2. **Categories**
- **Fields:**
- CategoryID (Primary Key)
- CategoryName
This table lists the product categories available, helping organize and classify products. Each CategoryID relates to multiple products in the Products table, forming a one-to-many relationship.
3. **Customers**
- **Fields:**
- CustomerID (Primary Key)
- FirstName
- LastName
- Email
- Phone
This table stores customer information. Each CustomerID uniquely identifies a customer.
4. **Orders**
- **Fields:**
- OrderID (Primary Key)
- CustomerID (Foreign Key)
- OrderDate
- TotalAmount
This table records customer orders. Each order is linked to a specific customer (CustomerID), establishing a one-to-many relationship between Customers and Orders.
5. **OrderDetails**
- **Fields:**
- OrderDetailID (Primary Key)
- OrderID (Foreign Key)
- ProductID (Foreign Key)
- Quantity
- Subtotal
Statistics The Exploration & Analysis Of Data
ISBN: 9780840058010
7th Edition
Authors: Roxy Peck, Jay L. Devore