Questions tagged [sakila-database]
10 questions
1
vote
1 answer
Extract net inventory for each store in each city
The company wants to analyze the scale of inventory kept in stores to estimate the size and design of the fulfillment centers. You need to combine the inventory data, store data, and city data such that your rows represent the net inventory for each…

LazyBoy1805
- 21
- 3
1
vote
0 answers
Extract the number of active customers in each city; the result should also contain cities with zero active customers in them
My query as follows along with screenshot from mysql workbench. I have used "Sum" instead of "Count" because, when I use "Count" then cities where active customers are actually "0" the results return as "1". Whereas when I use "Sum" then cities…

LazyBoy1805
- 21
- 3
0
votes
2 answers
MySQL - Use of Group BY clause
I am using the Sakila Database for practice.
I am calculating - Sales by Store. It provides a list of total sales, broken down by store. It incorporates data from the city, country, payment, rental, inventory, store, address, and staff tables
I have…

Apoorvaa Singh
- 29
- 1
- 6
0
votes
1 answer
MySQL grant function not working properly MySQL WorkBench 8.0
I defined grants for the user John :
grant select on * to JOHN@localhost;
and upon running:
show grants for JOHN@localhost;
I get :
GRANT SELECT ON *.* TO `JOHN`@`localhost`
But when I try to remove the grant from a specific table, actor:
revoke…

Hasan
- 1
0
votes
1 answer
SELECT/COUNT statement works alone but doesn't work in the context of the table
I'm a student using sakila dvd rental database to do a project, using PostgreSQL 15.2 and pgAdmin4. After some other work, I have this code populating a table that is going to compare rental duration and frequency among categories:
INSERT INTO…

jerry_lemon
- 11
- 1
0
votes
0 answers
Sakila with customer x and why who has rented at least 5 movies
Trying to create query with Sakila that finds for each customer X and another customer Y both of who have rented at least 5 movies from the same actor, such that the actor has acted in more than 5 movies. Find all such pairs of Customers (X, Y) and…

Ben10
- 1
- 1
0
votes
1 answer
SELECT * FROM sakila.actor; where first_name =TOM?
What is correct MY SQL syntax for to get the First_name = TOM from Sakila database?
I am writing this syntax but getting wrong answer
SELECT * FROM sakila.actor; where first_name = TOM
But getting error message like below:
11:10:05 WHERE…

Ravi
- 3
- 1
0
votes
4 answers
SELECT name from table WHERE scalar subquery is true
How could I convert this:
SELECT CONCAT (c.first_name, ' ', c.last_name) AS customer,
SUM(CAST(p.amount as float)) AS total_amount
FROM customer c
INNER JOIN payment p ON c.customer_id=p.customer_id
GROUP BY c.customer_id
ORDER BY total_amount…

UnclePete
- 25
- 5
0
votes
1 answer
How can I get the following result set from mysql sakila database: List of all the films with film name and name of every actor in that film
I wrote the following query :
select film_id, actor_id
from sakila.film_actor
where film_id IN (
select film_id from sakila.film
)
which returns
film_id actor_id
1 1
1 10
1 20
....
2 19
2 85
But I also want to include…

apandey
- 85
- 1
- 4
- 13
-1
votes
1 answer
SQL Sakila Query Question - Find all actors that have starred in films of all 16 film categories
I am trying to put together a query from the Sakila database.
The query should find all actors that have starred in all 16 film categories.
To get all of this information into one table for querying, I have performed a INNER JOIN:
SELECT…

user2518312
- 17
- 4