Your question is SQL Bookstore Schema Practice. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Meta Logistics uses a bookstore payment dataset to monitor customer and catalog activity. Write a PostgreSQL query that summarizes valid completed book payments.
A payment counts only when status = 'paid' and amount > 0. Payments must reference an existing customer and book.
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer full name |
| VARCHAR(255) | Customer email address |
| Column | Type | Description |
|---|---|---|
| book_idPK | INT | Unique book identifier |
| title | VARCHAR(200) | Book title |
| author | VARCHAR(100) | Book author |
| Column | Type | Description |
|---|---|---|
| payment_idPK | INT | Unique payment identifier |
| customer_id | INT | Customer associated with the payment |
| book_id | INT | Book associated with the payment |
| amount | DECIMAL(10,2) | Payment amount in dollars |
| status | VARCHAR(20) | Payment processing status |