Sorry if this question is dumb. i am a beginner and for the past hour i’v been searching the internet for answer and i haven’t found one(maybe because i am bad at searching). Anyway, i am writing a query into python so i have to write the entire query into one line but i can’t seem to get it right.
SELECT students.first, students.middle, students.last, students.birth FROM students WHERE students.house = "Gryffindor" ORDER BY students.last ASC, students.first ASC
Advertisement
Answer
Here are two methods:
'''SELECT students.first, students.middle, students.last, students.birth FROM students WHERE students.house = "Gryffindor" ORDER BY students.last ASC, students.first ASC''' "SELECT s.first, s.middle, s.last, s.birth FROM students s WHERE s.house = 'Gryffindor' ORDER BY s.last ASC, s.first ASC"
The firsts uses multi-line strings. The second shortens the query a bit, uses single quotes for the embedded string (the SQL standard delimiter), and puts everything on one line.