When it comes to write code you don't need to learn magic spells.
All you need is to take a look outside the window and solve your problem with patterns from the real world.
Do you want to learn Postgres? Today you can spin up your database completely for FREE and start experimenting with one of the best database tools ever.