Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 749421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:25:58+00:00 2026-05-14T14:25:58+00:00

I have table with words dictionary in my language (latvian). CREATE TABLE words (

  • 0

I have table with words dictionary in my language (latvian).

CREATE TABLE words (
value varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

And let’s say it has 3 words inside:
INSERT INTO words (value) VALUES ('tēja');
INSERT INTO words (value) VALUES ('vējš');
INSERT INTO words (value) VALUES ('feja');

What I want to do is I want to find all words that is exactly 4 characters long and where second character is ‘ē’ and third character is ‘j’

For me it feels that correct query would be:
SELECT * FROM words WHERE value LIKE '_ēj_';
But problem with this query is that it returs not 2 entries (‘tēja’,’vējš’) but all three.
As I understand it is because internally MySQL converts strings to some ASCII representation?

Then there is BINARY addition possible for LIKE
SELECT * FROM words WHERE value LIKE BINARY '_ēj_';
But this also does not return 2 entries (‘tēja’,’vējš’) but only one (‘tēja’). I believe this has something to do with UTF-8 2 bytes for non ASCII chars?

So question:
What MySQL query would return my exact two words (‘tēja’,’vējš’)?

Thank you in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:25:58+00:00Added an answer on May 14, 2026 at 2:25 pm

    What MySQL query would return my exact two words (‘tēja’,’vējš’)?

    SELECT * FROM words WHERE value LIKE '_ēj_' COLLATE utf8_bin;
    

    The utf8_bin collation is not just diacritical-sensitive, but also case-sensitive. If you want to match only the letter-with-diacritical and you don’t care about upper/lower case, you would have to find a utf_..._ci collation that doesn’t treat e and ē as the same letter.

    I can’t immediately see one (there are plenty that don’t collate ē at all, which would be okay if you only need case-sensitive matching on the non-diacritical letters). Interesting that the Latvian collation treats macron-letters as the same as plain letters, which you don’t want (it knows š is different from s).

    Anyway, whatever collation you end up with, you will want to put your tables in that collation rather than manually specifying it in a query, so that comparisons can be properly indexed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table named 'Dictionary' with columns as follow: ID bigint TYPE varchar (200)
I have a database table with words from a dictionary. Now I want to
I have an online dictionary. All inputs are saved in table id-word-unixtime. Now I
I have a table of sentences, and a table of words. I am trying
I have two tables. One table contains words. Other table contains points. table words:
I have a table with a field where words are written separated with new
I have a table view with some words, and i present flash-card style landscape
I have a list of whitelisted words: kitchen chair table ; Given a text,
I need to implement a search engine. So I have a dictionary which is
I have a simple but huge table called 'dictionary' which has 2 columns. Id

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.