Alternative Soln: Generate a list of students with last names from A to M
I found that the following also works. Not sure how performant it is though...
SELECT id, first_name, last_name FROM students WHERE last_name BETWEEN 'A%' AND 'N%' ORDER BY last_name;
Steven Parker203,443 Points
The wildcard function of "%" only applies when used with
LIKE, but here it makes no significant difference because it comes before any letter by value. So the filter is essentially the same as
BETWEEN "A" AND "N", and the only risk would be if someone actually had a last name of "N" they would be included in the result set.
Mohammad Bazarbay1,967 Points
I did something similar. Here is what I did:
SELECT * FROM STUDENTS WHERE LAST_NAME BETWEEN 'A' AND 'N' ORDER BY LAST_NAME ASC;
This worked for me
SELECT * FROM STUDENTS
WHERE LAST_NAME BETWEEN "A" AND "N"
ORDER BY LAST_NAME ASC;
kevin hudsonCourses Plus Student 9,652 Points
I immediately thought of < operator here was my go at it:
-- Generate a list of students with last names from A to M. SELECT * FROM STUDENTS WHERE LAST_NAME < 'N' ORDER BY LAST_NAME;
Miguel Richardson3,336 Points
SELECT LAST_NAME || ', ' || FIRST_NAME AS 'STUDENTS' FROM STUDENTS WHERE LAST_NAME > 'A' AND LAST_NAME < 'N' ORDER BY LAST_NAME ASC
I used a concatenate function to produce an a single column output.