← All tables and views

Sakila view

sales_by_store

Native view in the Sakila sample database.

2rows

3 columns

Schema from the provider contract
ColumnTypeNullableKeyReferences
storeyes——
manageryes——
total_salesyes——

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.city

Data preview

Sample records

2 rows available
storemanagertotal_sales
Lethbridge,CanadaMike Hillyer33679.79
Woodridge,AustraliaJon Stephens33726.770000000004