How would I retrieve a specific row in a SQLite database, when I only have a part of a column’s data?
Following table, named foo:
| id | randomKey |
| 1 | af202fn02fe |
| 2 | 02fe9fwefew |
Now I want to get the id, where the randomKey starts with af202, which would be 1.
How would my SQL-Query look like?
'SELECT id FROM foo WHERE randomKey = ?', []
Use a
LIKEclause. In aLIKEclause, the%operator is used to wild-card data:%will match any or no characters.LIKE 'af202%'LIKE %af202'LIKE '%af202%'