r/ProgrammerDadJokes • • Mar 22 '22

A SQL query walks into a bar…

It walks up to two tables and says, “Mind if I join you?”

437 Upvotes

25 comments sorted by

98

u/Alex_Sherby Mar 22 '22

WHERE is the bathroom?

29

u/vkapadia Mar 22 '22

That's where it goes to inject.

12

u/EquationTAKEN Mar 22 '22

I had something for this but I didn't prepare a statement.

12

u/Eluvatar_the_second Mar 22 '22

select lat, lon from locations where name = "bathroom"

10

u/Alex_Sherby Mar 22 '22

Lowercase keywords ? BLASPHEMY

7

u/TheJessicator Mar 22 '22

Where what is the bathroom?

2

u/HearMeSpeakAsIWill Mar 23 '22

WHERE bathroom = TRUE

2

u/imzacm123 Mar 23 '22

That sounds like a very future proof table, I'm guessing it allows for (bathroom = true AND bedroom = true)

1

u/marcosdumay Mar 22 '22

That's not a question.

31

u/hughperman Mar 22 '22

It goes to the bar and orders everything it can get its hands on because it doesn't know its own limits

21

u/existential_issue Mar 22 '22

On one condition…

9

u/chadding Mar 22 '22

Where 1=1

5

u/existential_issue Mar 22 '22

You mean “on 1=1”? Ye Olde Cartesian Product Pub?

4

u/chadding Mar 22 '22

Ah yes, interesting place. Try the duplicate special, just about everyone has been served it on occasion, but almost no one meant to request it.

2

u/TheDruidsKeeper Mar 23 '22

May I have your primary key?

13

u/chadding Mar 22 '22

Without any join conditions all the tables in the bar become one giant Cartesian table which overflows the bar and locks out all the patrons.

9

u/chadding Mar 22 '22

The bartender tries to kill the query but he accidentally dropped his keys and never recovered.

17

u/codexcdm Mar 22 '22

Drop tables.

7

u/sam_matt Mar 23 '22

Why don't you sit with that GROUP BY the window

6

u/SupahCraig Mar 22 '22

Waiter walks up and asks “what are you HAVING?”

3

u/DABarkspawn Mar 24 '22

And the query says, "I need a menu to ORDER BY."

1

u/SupahCraig Mar 24 '22

Just order by the numbers.

1

u/DABarkspawn Mar 24 '22

Oh, is this a bakery?

5

u/TheLastCakeIsaLie Mar 22 '22

Is that legal? /s

2

u/PopeInnocentXIV Mar 23 '22

Bartender says "I'm going to need your keys."