Honour Roll Through a CTE
easyQuestion 42Write a CTE named honour_roll that selects first_name, last_name and gpa for every student whose gpa is 3.5 or higher, then select those three columns from honour_roll. Sort by gpa descending, then last_name. Students with a NULL gpa fall out of the filter on their own.
Expected result
+------------+-----------+------+ | first_name | last_name | gpa | +------------+-----------+------+ | Evelyn | Park | 3.98 | | Sophia | Rossi | 3.92 | | Grace | Lee | 3.88 | | Mia | Haddad | 3.8 | | Ava | Patel | 3.8 | | Emily | Zhang | 3.72 | | Charlotte | Dubois | 3.67 | | Scarlett | Johnson | 3.6 | | Harper | Singh | 3.55 | | Zoe | Campbell | 3.5 | +------------+-----------+------+ 10 rows
Hints3 available
Sign in to use hintsTopics
CTEs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)
Results
Run your SQL to see every statement's output here, then how it compares with the expected answer.
Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns, or open the database browser under the question.