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

Donnie Driskell
Donnie Driskell
2,243 Points

Challenge Question that matches a pattern (SOLVED)

In the e-commerce database we have a products table. The columns are id, name, description and price.

Find all the products where the pattern 't-shirt' can be found anywhere in the product name. https://teamtreehouse.com/library/sql-basics/finding-the-data-you-want/finding-data-that-matches-a-pattern-2

Ok, after (an embarrassing 10 tries, I give up). I started out course doing great...

It seems obvious to me that the query needs to have % wildcard and I have tried its syntax placement at beginning and end and both along with t-shirt. I will list all my tries here, but I really ashamed too, but for the sake of learning, I need to stop guessing. Yes, it is obvious that I just started guessing after the first few "bummers".

I watched video again and this time I used " " in the t-shirt - problem is I was using ' ' (single quotes)

SELECT * FROM products WHERE name LIKE "%t-shirt%";

again, I really appreciate the help here. Thanks in advance, but I can't believe that I solved it. Donnie

1 Answer

I used single quotes, and it still worked ....... of course, that was after my own bazillion attempts and coming to this question myself. Turns out my issue was SELECT * FROM * products. sigh