I have a database with 2 columns, with the name of the players written in this format:
| Player1 | Player2 |
|---|---|
| Yang Y. | Ying G. |
| Kim G. | Uin Y. |
I should find all the rows containing the name of the players but only with the surname, like Yang, without Y.
So I thought to use the LIKE query, like this:
for game in final_table:
name = "Yang"
cur1.execute("SELECT * FROM matches WHERE Player1 like ?", [name])
match = cur1.fetchall()
print(match)
It gives me nothing in return. Instead if I write the entire name like this:
for game in final_table:
name = "Yang Y."
cur1.execute("SELECT * FROM matches WHERE Player1 like ?", [name])
match = cur1.fetchall()
print(match)
It works properly. What am I doing wrong?