
Sorting with ORDER BY - Assignments
1. Default sorting by first names of actors
Complete the following query to obtain all data from the actors table. Sort by default (ascending) on the first name of actors (column first_name).
- Use
SELECTandFROMto make the selection. - Use
ORDER BYto sort by columnfirst_name.
2. Default sorting by number of films of actors
Complete the following query to obtain all data from the actors table. Sort by default (ascending) on the number of films of actors (column film_count).
- Use
ORDER BYto sort by columnfilm_count.
3. Descending sorting by number of films of actors
Complete the following query to obtain all data from the actors table. Sort descending by the number of films of actors (column film_count).
- Use
ORDER BYand keywordDESCto sort descending by columnfilm_count.
4. Descending and ascending sorting by number of films and first names of actors
Complete the following query to obtain all data from the actors table.
- Sort descending by the number of films of actors (column
film_count). - And ascending by the first name of actors (column
first_name). - Use
ORDER BYand keywordsASCandDESC.
5. (Extra) Sorting by the number of characters in the last name
Complete the following query to obtain all data from the actors table.
- Sort ascending by the number of characters in the last name of actors.
- Use the function
LENGTH().
6. (Extra) Sorting by the number of characters in the last name
Complete the following query to obtain a selection of data from the actors table.
- Select (filter) where the second letter in the first name is equal to
o, regardless of whether it is lowercase or uppercase. - Also select where the number of films is greater than
1. - Sort descending the first name of actors.