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

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,332 Points

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