2rows
3 columns
Schema from the provider contract| Column | Type | Nullable | Key | References |
|---|---|---|---|---|
store | | yes | — | — |
manager | | yes | — | — |
total_sales | | yes | — | — |
View definition
CREATE VIEW "sales_by_store" AS SELECT (c.city || ',' || cy.country) AS store , (m.first_name || ' ' || m.last_name) AS manager , SUM(p.amount) AS total_sales FROM payment AS p INNER JOIN rental AS r ON p.rental_id = r.rental_id INNER JOIN inventory AS i ON r.inventory_id = i.inventory_id INNER JOIN store AS s ON i.store_id = s.store_id INNER JOIN address AS a ON s.address_id = a.address_id INNER JOIN city AS c ON a.city_id = c.city_id INNER JOIN country AS cy ON c.country_id = cy.country_id INNER JOIN staff AS m ON s.manager_staff_id = m.staff_id GROUP BY s.store_id ORDER BY cy.country, c.cityData preview
Sample records
| store | manager | total_sales |
|---|---|---|
| Lethbridge,Canada | Mike Hillyer | 33679.79 |
| Woodridge,Australia | Jon Stephens | 33726.770000000004 |