Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,932 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.