r/SQL • • 14d ago

PostgreSQL Where did I go wrong?

Thumbnail
gallery
29 Upvotes

For context, photos 1-2 show the original prompt + my answer. Photo 3 shows the solution. The output is somewhat similar to the correct answer, but not quite the same.

When I move the "status = 'Completed'" either to the "WHERE" section or to the JOIN section as "AND status = 'Completed'" it solves the problem, but not sure exactly why.

r/SQL • • Sep 24 '26

PostgreSQL What SQL concepts do you understand but still forget?

125 Upvotes

There are some SQL concepts I understand perfectly when I’m using them, but somehow forget when I need them again a few weeks later.

For me, CTEs and stored procedures are two good examples. I’ve used both, but I still end up looking up the syntax when I need them again. 😅

Anyone else have a few SQL concepts like this?

r/SQL • • May 20 '26

PostgreSQL What are common SQL red flags?

51 Upvotes

Hello! interview prepping, here wondering what are some common red flags for wrioting SQL?

Like

LIKE failing to index, not having trasnactions, usign SELECT * instead of specific collums, etc 😃

r/SQL • • Jun 24 '26

PostgreSQL Postgresql on Vs code?

7 Upvotes

Anybody here uses postgresql on vscode or pg admin is just better long term?

r/SQL • • Oct 28 '26

PostgreSQL Why Microsoft contributes to Postgres: What I tell people

Thumbnail
techcommunity.microsoft.com
34 Upvotes

People ask me this question more than I like so I thought I would share the answer once and for all: why does a company like Microsoft contribute to an upstream open source project like Postgres?

Let me know what you think. Anything surprising? Did I miss anything?

r/SQL • • 18d ago

PostgreSQL Postgres 19 makes NOT IN 10,000x faster... or 2,000x slower - Which one you get depends on a NOT NULL in your schema, and on how long the list is.

Thumbnail
exobench.ai
23 Upvotes
My write-up, measured on PG17, PG18 and PG19rc2. Declare both columns NOT NULL and PG19 runs NOT IN as an anti join: 1.1 s on PG18, 0.06 ms on PG19. Leave one nullable, even with zero NULLs in it, and PG19 skips the rewrite and stops hashing the list at 154,199 rows instead of 262,144, so 44 ms on PG18 became 101,734 ms. NOT EXISTS was fast on all three.

r/SQL • • 18d ago

PostgreSQL PostgreSQL For personal budgeting and finance?

16 Upvotes

Im somewhat new to SQL and i want to apply it to my personal life so its easy to keep my skills and knowledge of it fresh since its what i want to do in the future.

I was thinking about setting up a local PostgreSQL database to use with VSCode on my personal computer to just monitor and record my everyday things like my banking/budgeting, random projects that i fall into a hole working on, etc.

I wanted to get some opinions on if this is a good idea, is it safe security wise, is there a better way to go about this, should i just scrap this idea, etc.

Please let me know and educate me!

Everytime i look it up its mainly about business related things like for creating apps etc. but i dont really plan on using it for anything other than my personal projects and plans.

(I chose postgresql because its just one of the more common ones ive seen in job postings etc. and i saw its pretty much free locally)