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 Modifying Data with SQL Deleting Data From a Database Review and Practice

Removing actors where names contain accents etc.

Hi all,

Just in the process of completing the tasks set in SQL playground for this video.

-- Remove actors with the first name "Yuri", "Walter" and "Victor".

I've completed this task using the following command:

DELETE FROM actors WHERE name LIKE "Yuri %" OR name LIKE "Walter %" OR name LIKE "Victor %";

However, when looking through the schema, I can see there is still an entry for Víctor Israel. This is due to the i having an accent.

What would be the best way of removing this entry ensuring that nobody else got deleted?

Theoretically, we could have an actor with the name Val Spector Davis - a LIKE operator of "V%ctor %" would remove that entry too.

Any of your thoughts would be welcome.

Many thanks, Berian

2 Answers

Why not just use name LIKE 'Víctor %'? You can run as a SELECT statement to review the results before running as a DELETE statement.

You could also use an underscore which matches a single character as in: name like 'V_ctor %'

Thanks Kris,

I was just talking hypothetically - Imagine having to recreate the statement for every variation of accents for just I and O there are 10! i í ì ĩ o ó ò õ ô ơ

Appreciate your time on this.

Berian