SQLite Forum

How can I split a name column into first and last names?
Login
Real world names are complicated, someone will inevitably write a long reply or post a link on the topic.
 
Ignoring that, if you want to find the first word in a text field you can use [instr](https://www.sqlite.org/lang_corefunc.html#instr) and [substr](https://www.sqlite.org/lang_corefunc.html#substr) with something like

`where upper(substr(names, 1, instr(names, ' ') - 1)) = 'MERYL'`
 
I haven't checked if that works and doesn't raise an error on things like the empty string, or text fields without a space, etc. But it's a place to start