List titles of films with 10 or more actors playing the act. Sort the output on descending order of actors per film.will the below query will provide you the correct result SELECT title as Film_Name, count(actor_id) as Total_ActorsFROM filmINNER JOINfilm_actorONfilm.film_id=film_actor.film_idGroup by film.film_idhaving Total_Actors > 9ORDER BYTotal_Actors DESC, titlea.Trueb.False
Question
List titles of films with 10 or more actors playing the act. Sort the output on descending order of actors per film.will the below query will provide you the correct result SELECT title as Film_Name, count(actor_id) as Total_ActorsFROM filmINNER JOINfilm_actorONfilm.film_id=film_actor.film_idGroup by film.film_idhaving Total_Actors > 9ORDER BYTotal_Actors DESC, titlea.Trueb.False
Solution 1
b. False
The query will not run because the HAVING clause is referencing an alias (Total_Actors) which is not allowed in SQL. The HAVING clause should reference the actual aggregate function, not the alias. The corrected query would be:
SELECT title as Film_Name, count(actor_id) as Total_Actors FROM film INNER JOIN film_actor ON film.film_id=film_actor.film_id GROUP BY film.film_id HAVING count(actor_id) > 9 ORDER BY count(actor_id) DESC, title
Solution 2
b. False
The query will not provide the correct result because the "Group by" clause should include all the columns that are not part of an aggregate function. In this case, the "title" column is not included in the "Group by" clause. The corrected query should be:
SELECT title as Film_Name, count(actor_id) as Total_Actors FROM film INNER JOIN film_actor ON film.film_id=film_actor.film_id Group by film.film_id, title having Total_Actors > 9 ORDER BY Total_Actors DESC, title
Similar Questions
Modify the query with the following specifications:a. ‘Title’: Grouped by.b. ‘SeatNumber’: Count.c. Only display data from the ‘Movie’ and ‘CountOfSeatNumber’ fields. If you run thequery, it should look like this
Write SQL query considering below schema of databaseFilm(film_id, title, legth, rental_rate), Actor(film_id, actor_id, first_name, last_name)Category(film_id, rating, language, release_year)Create tables with Primary Key, foreign key constraints in given schemas.i.Give the name of actors whose actor id is 23.ii.Give the title of films whose id is between 25 and 40.iii.Give the name of actor whose last name contains Kapoor.iv.Give the title of film which was released in 2022.v.Give the name of actors played who have role in film title ‘Chhello divas’
Consider the following database:MOVIE(id,title,yr)ACTOR(id,name)CASTING(movieid,actorid)Identify the SQL command which will return the titles of all 1959 Marilyn Monroe films.Option 1. The following SQL...SELECT title FROM movie,casting,actor WHERE movieid = movie.id<> AND name = 'Marilyn Monroe' ; Option 2. The following SQL...SELECT title FROM movie,actor WHERE name = 'Marilyn Monroe' AND yr = 1959 ; Option 3. The following SQL...SELECT title FROM movie,casting,actor WHERE movieid = movie.id AND actor.id = actorid AND name = 'Marilyn Monroe' AND yr = 1959 ; Option 4. The following SQL...SELECT title FROM movie,casting,actor WHERE movieid = movie.id AND actor.id = actorid AND movie.yr = casting.yr AND name = 'Marilyn Monroe' AND yr = 1959 ; Question 5Select one:a.Option 1b.Option 2c.Option 3d.Option 4
The below query is correct or In-correctselect * from actors where actor_id in (select* from film_actor)a.Trueb.False
Write a SQL query to count the number of characters except for the spaces for each actor. Return the first 10 actors' name lengths along with their names.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.