Not Boring MoviesX city opened a new cinema, many people would like to go to this cinema. Thecinema also gives out a poster indicating the movies’ ratings and descriptions.Please write a SQL query to output movies with an odd numbered ID and adescription that is not 'boring'. Order the result by rating.For example, table cinema:idmoviedescriptionrating1Wargreat 3D8.92Sciencefiction8.53Irishboring6.24Ice SongFantasy8.65House cardInteresting9.1For the example above, the output should be:idmoviedescriptionrating5House cardInteresting9.11Wargreat 3D8.9Optionsselect movie, description, ratingfrom cinemawhere id % 2 != 1 and description <> 'boring'order by rating asc;select id, movie, descriptionfrom moviewhere rating % 2 = 1 and description <> 'boring'order by rating;select id, movie, description, ratingfrom cinemawhere id % 2 = 1 and description <> 'boring'order by rating desc;select id, movie, description, ratingfrom ratingwhere id % 2 = 1 and description <> 'boring'order by cinema desc;
Question
Not Boring MoviesX city opened a new cinema, many people would like to go to this cinema. Thecinema also gives out a poster indicating the movies’ ratings and descriptions.Please write a SQL query to output movies with an odd numbered ID and adescription that is not 'boring'. Order the result by rating.For example, table cinema:idmoviedescriptionrating1Wargreat 3D8.92Sciencefiction8.53Irishboring6.24Ice SongFantasy8.65House cardInteresting9.1For the example above, the output should be:idmoviedescriptionrating5House cardInteresting9.11Wargreat 3D8.9Optionsselect movie, description, ratingfrom cinemawhere id % 2 != 1 and description <> 'boring'order by rating asc;select id, movie, descriptionfrom moviewhere rating % 2 = 1 and description <> 'boring'order by rating;select id, movie, description, ratingfrom cinemawhere id % 2 = 1 and description <> 'boring'order by rating desc;select id, movie, description, ratingfrom ratingwhere id % 2 = 1 and description <> 'boring'order by cinema desc;
Solution
The correct SQL query to output movies with an odd numbered ID and a description that is not 'boring', ordered by rating is:
SELECT id, movie, description, rating
FROM cinema
WHERE id % 2 = 1 AND description <> 'boring'
ORDER BY rating DESC;
This query works by filtering the 'cinema' table for rows where the 'id' is odd (id % 2 = 1) and the 'description' is not equal to 'boring'. It then orders the resulting rows by the 'rating' column in descending order.
Similar Questions
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’
SELECT * from movies WHERE imdb_rating > 7.95 + (select stddev(imdb_rating) from movies) OR imdb_rating < 7.95 - (select stddev(imdb_rating) from movies)
You are managing a database for a movie production company. The database includes information about actors, directors, movies, movie cast, and ratings.Write a query for updating the ratings of all movies directed by 'Lankesh' to a new rating of 3 in a database that contains information about actors, directors, movies, movie casts, and ratings.The following table is already created, and the records are inserted into the table.
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
Sarah, a reviewer for MovieMania Reviews, is updating the database with recent ratings and reviews for the film 'Tenet' directed by Christopher Nolan.Create a program that records and displays the rating and review details for the movie.Input format :The first line of input consists of an integer N, representing the movie rating (1 to 5 stars).The second line consists of a string containing the review text.Output format :The first line of output prints "Recent Review Rating: [N] stars"The second line prints "Review Details: " followed by the review text.Refer to the sample output for formatting specifications.Code constraints :1 ≤ N ≤ 5Sample test cases :Input 1 :4The movie has a complex narrative but is visually stunning.Output 1 :Recent Review Rating: 4 starsReview Details: The movie has a complex narrative but is visually stunning.Input 2 :5An incredible film with mind-blowing sequences and outstanding performances.Output 2 :Recent Review Rating: 5 starsReview Details: An incredible film wit
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.