MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Write the code for the following:Return all movies made before 2011 and order by the imdb rating from highest to lowest.
A
RETURN * FROM movies WHERE year < 2011 AND imdb ____ rating ASC;
B
SELECT * FROM movies WHERE year > 2011 ORDER BY imdb ____ rating DESC;
C
SELECT * FROM movies WHERE year < 2011 ORDER BY imdb ____ rating DESC;
D
SELECT * FROM movies WHERE year = 2011 ORDER BY imdb ____ rating ASC;
Explanation: 

Detailed explanation-1: -The ORDER BY keyword is used to sort the result-set in ascending or descending order. The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.

Detailed explanation-2: -The ASC command is used to sort the data returned in ascending order.

Detailed explanation-3: -The ORDER BY clause must come after the WHERE, GROUP BY, and HAVING clause if present in the query. Use ASC or DESC to specify the sorting order after the column name. Use ASC to sort the records in ascending order or use DESC for descending order.

Detailed explanation-4: -Syntax. SELECT column-list FROM table name [WHERE condition] [ORDER BY column1, column2, .. columnN] [ASC | DESC]; You can use more than one column in the ORDER BY clause.

There is 1 question to complete.