Classmates From Ava's City
mediumQuestion 104Find every other student who lives in the same city as Ava Patel, without typing the city name yourself. Return the other students' first_name, last_name and city, sorted by last_name. Ava herself must not appear.
Expected result
+------------+-----------+---------+ | first_name | last_name | city | +------------+-----------+---------+ | Elijah | Costa | Toronto | | Lucas | Fernandes | Toronto | | Scarlett | Johnson | Toronto | | Noah | Kim | Toronto | | Leo | Martin | Toronto | | Mason | Nguyen | Toronto | | Emily | Zhang | Toronto | +------------+-----------+---------+ 7 rows
Hints3 available
Sign in to use hintsTopics
Joins
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.