Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases

Gangadhar V
Gangadhar V
3,037 Points

how to filter the results to show only names starting with A through K

how to filter the results to show only names starting with A through K

3 Answers

Hey Gangadah,

I think the < (Less) and > (Greater) than sign with the WHERE clause will work.

WHERE name < "L"  --> will return all names between A-K.

For example

SELECT first_name, last_name, age
FROM phone_book 
WHERE last_name < "L" ;     

Hope it works.

ivana kantnerova
ivana kantnerova
15,761 Points

SELECT Name FROM Employees WHERE Name LIKE '[A-K]%'

Hi Avana, I think your filter works in MySQL but not SQLite which Treehouse workspaces uses by default.