I'm working with a free dataset from Kaggle to learn SQL further and I've hit a spot where I am stuck. I'm working with an NFL Draft dataset that has player names listed like this: FirstName LastName\UserName
However, some of the rows are simply this: FirstName LastName
I wrote this code and have had some success:
SELECT position, substr(Player,0,instr(Player,'\')) AS Player_Name
This specfic code works great on any rows that are formatted like FirstName LastName\UserName but for any rows that are formatted like this FirstName LastName it returns a blank for the Player_Name.
Any tips on how I can fix this to show the FirstName LastName ONLY on my query for both ways?