SQL Multiple choices


Total available count: 51
Subject - Databases
Subsubject - SQL

With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?


 

 

 

 



A


Solution:-

The SQL ORDER BY Keyword
The ORDER BY keyword is used to sort the result-set in ascending order or descending order.

By default, the ORDER BY keyword sorts the records in ascending order. Use the DESC keyword to sort the records in descending order.

ORDER BY Syntax is given as follows:

SELECT column1, column2, column3, ...FROM table_name ORDER BY column1, column2, column3,... ASC|DESC;

ORDER BY Example is given as follows:
The following SQL statement selects all courses from the "SlightBook" table, sorted by the "Fees" column:

Example

SELECT * FROM SlightBook ORDER BY Fees;

 




Next 5 multiple choice(s)

1

Which SQL keyword is used to sort the result-set?

2

Which SQL statement is used to return only different values?

3

With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

4

With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

5

The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true

Comments