Write an SQL query to report the movies with an odd-numbered ID and a description that is not "boring". Return the result table ordered by rating in descending order.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter11: Sql Server Databases
Section: Chapter Questions
Problem 6E
icon
Related questions
Question
Assume you have a table in database called Cinema' with the following schema:
Table: cinema
| Column Name
1 Туре
+-
| id
| movie
| description
| rating
| int
| varchar
| varchar
| float
+----
---+
id is the primary key for this table.
Each row contains information about the name
a movie, its genre,
it
rating.
rating is a 2 decimal places float in the range [0, 10]
The table has the following records of data:
Input:
Cinema table:
+----+---
| id | movie
| description | rating |
+----+-
| 1
| 2
| 3
| 4
| 5
| War
| Science
| irish
| Ice song
I great 3D
| fiction
| boring
| Fantacy
| House card | Interesting | 9.1
| 8.9
| 8.5
| 6.2
| 8.6
+---
Write an SQL query to report the movies with an odd-numbered ID and a description that is not
"boring".
Return the result table ordered by rating in descending order.
The results should be:
Output:
+--
| id | movie
| description | rating |
+----+
| 5
| 1
| House card | Interesting | 9.1
| 8.9
|War
great 3D
+----+
Transcribed Image Text:Assume you have a table in database called Cinema' with the following schema: Table: cinema | Column Name 1 Туре +- | id | movie | description | rating | int | varchar | varchar | float +---- ---+ id is the primary key for this table. Each row contains information about the name a movie, its genre, it rating. rating is a 2 decimal places float in the range [0, 10] The table has the following records of data: Input: Cinema table: +----+--- | id | movie | description | rating | +----+- | 1 | 2 | 3 | 4 | 5 | War | Science | irish | Ice song I great 3D | fiction | boring | Fantacy | House card | Interesting | 9.1 | 8.9 | 8.5 | 6.2 | 8.6 +--- Write an SQL query to report the movies with an odd-numbered ID and a description that is not "boring". Return the result table ordered by rating in descending order. The results should be: Output: +-- | id | movie | description | rating | +----+ | 5 | 1 | House card | Interesting | 9.1 | 8.9 |War great 3D +----+
Expert Solution
Step 1 : Algorithm

1. To get moving we use where clause with condition and  order by.

1. first we filter id by MOD inbuilt function to get odd numbered index row.

2. get all the movies description is not equal to 'boring'

3. order by the rating in descending i.e. sorted highest to lowest.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Complex Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning