I'd like to reinforce 3 messages in this thread.
1st) If you want to own a firearm for protection, you must decide that you are ready, willing and able to kill; there is NO 2nd choice in this. The only reason to shoot anything is to make it dead, that appertains both to putting food on the table and in protecting life with deadly force. Shooting to make the "bad guy" go away is a sure path to jail.
2nd) A .22 LR handgun or rifle is a wonderful, inexpensive to feed, training tool. You can put 100's of holes in paper at the range with one of them for the cost of a double stack magazine full of premium 9 mm or 45 ACP defensive ammunition.
3rd) Find a mentor and get proper training!!! I've handled firearms for 50 years and there are still many, many things I do not know. That's with experience as a casual plinker, competitive marksman, military veteran, NRA Range Safety officer, Hunter's Safety instructor, BSA Merit badge adviser, hunter, gunsmith, reloader...experience working at 4 different weapons related museums...retail years selling firearms and ammo in 6 different states, along with advising hundreds of new shooters over the years.
There is no substitute for face to face learning.