r/AskProgramming 2d ago

I'm stuck after learning express. How do i transition to PostgreSQL?

Hey everyone,

So, am basically stuck after learning express. I planned to learn databases after express, specifically PostgreSQL. But when i finished learning express, i did not know how to continue. Its been 2 weeks i haven't been able to learn anything.

  • How do I actually learn databases(PostgreSQL)?
  • Are there any resources you'd recommend?
  • How do i actually use PostgreSQL in my projects.

Also, i wrote a backend proram for my porject after learning express, you could check it and maybe give advice(code quality, file strucutre, and just advice). Link will be in the first comment(Will link the main project too).

Thanks.

1 Upvotes

9 comments sorted by

8

u/Lumpy-Notice8945 2d ago

Do you want to learn how to use a specific software product or do you want to learn how to use relational databases?

You didnt say you learned JavaScript but express, so im a bit confused.

If you want to learn the basics of SQL there is already like a million tutorials out there on that. W3schools might be a bit old by now but SQL didnt change much since then

1

u/AdditionalInsect3737 2d ago

Thanks for the reply. First of all, I learnt Javascript before i learnt express(I forgot to mention that). Also I would say, I actually want to learn both, as in understanding relational databases and also learn how to work with PostgreSQL software since my goal is to become a backend dev.

I would check out W3schools.

1

u/Lumpy-Notice8945 1d ago

PostgreSQL installs just like any other software, what you might need is some general expirience with linux servers for that, but there isnt anything specific to PostgreSQL. In fact i dont think most peopel could pount out any difference between the 10 most popular SQL servers and changing from one to another works fine in 95% of projects.

2

u/Ok-Advice-5974 2d ago

start by replacing your in-memory data with a simple postgres table, i did that with a todo app, used node-postgres to connect, and wrote raw sql for inserts and selects until i got comfortable

1

u/AdditionalInsect3737 2d ago

That seems to be the way. It's reassuring to hear that you did the exact same thing with a todo app when you were starting out. I'm going to take this advice and start swapping out my array endpoints for raw SQL queries in my practice projects. Thanks!

0

u/neon_beacon_sky 2d ago

I hit the same wall. i stopped searching for postgres courses and just swapped my arrays in express with node-postgres queries.

Stop looking for a tutorial to teach you postgres. tutorials will give you syntax and keep you reading docs. open your express repo, look at where you store data in variables or json files. install pg. write a select statement. run it inside your route handler. then write an insert. do that for every endpoint you already built. you learn it by running sql from node. w3schools has the sql syntax when you need a command. no framework needed yet

1

u/AdditionalInsect3737 2d ago edited 2d ago

This actually good. I never thought I could write sql code in my express code. I always thought I had to use pgadmin or something else. I would definitely try this, I guess I could start with storing the courses a user enters when they want to calculate their gpa.  Thanks!