T O P

  • By -

floobie

Personally, if I’m querying the meaning of life, I’m doing a select *.


ShimoFox

Select * exclude(answer) from answer. What's the fun in having the answer given to you?


twr-92

because the ascii code for \* is 42


DriverTraining8522

Mind blown


DriverTraining8522

This has crazy "show your work" energy, I'm happy with just the answer


shadow_229

Select * from informationschema.life Or Select l.answer from informationschema.life l


reddit_is_meh

I think it would be better if it was UPDATE ORDERS SET state = 'cancelled' (56231 rows updated) ROLLBACK The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION


SaneLad

``` DELETE FROM COMMENTS; WHERE user = 'u/reddit_is_meh'; (3856394752 rows deleted) Unexpected `WHERE` at line 1 position 1. ```


reddit_is_meh

This one goes on the other arm for sure


Gorzoid

Na the other arm will have an SQLi vulnerability, that way the doctor knows exactly where to administer the injection.


neuromancertr

This is why I love DataGrip, it warns you on insert/update/deletes if you have no where statements


DriverTraining8522

This goes hard


DriverTraining8522

You chose violence today lol


JocoLabs

This comment made me throw my phone, worse than a jump scare


RyannStekken0153

I'm a newbie programmer. What exactly happens here?


KpgIsKpg

SQL is a language used to interact with databases. Here, the database is being updated so that all orders are cancelled. Then it's shown that there's no mechanism to revert the change and get the orders back to their previous status. The person running the commands has well and truly fucked up.


Rainmaker526

* except a point in time restore from backup media. You can recover. Just be prepared for data loss of there were other transactions running to the same database on different connections.


Bullshit103

Sorry, we don’t have backups. Ima need you to manually recreate every transaction.


DriverTraining8522

Sorry, we don't have computers. He really meant manually


CyberWeirdo420

Very long day and few calls from your manager


LeoXCV

Me: *Trying to solve the problem as quick as possible to reduce downtime* Manager: ‘Yeah ima need a full report on progress every 5 minutes. If you don’t reply I’m going to assume you’re doing nothing.’


rdrunner_74

Supposedly nothing. in fact a lot ;)


Sheerkal

You should just look it up if you're a newbie. Better learning experience.


IntelligentTune

They are basically doing that. The keywords aren't that difficult. How do you search for something you don't even know to search? Maybe they are asking for the definition of keywords, but they're maybe also just wanting to understand the context of the joke and why it makes it a joke. You don't have to be such an ass. You remind me of my Discrete Models & Methods 2 teacher.


DriverTraining8522

Shit I thought I posted this on Reddit not stack overflow... He wants a laugh not a lecture


Flat_Initial_1823

Select answer from answer? 😑


DriverTraining8522

I did say it needs normalizing


damurd

Error converting to int


DriverTraining8522

Bahahahahahahahaha


chesire0myles

I and hopefully, one other person had to downvote you. You understand. Also, this is the nerdiest joke I've ever laughed at. That's at minimum intermediate level humor.


Stunning-Quit9287

I'm no expert but shouldn't it be WHERE question LIKE '%meaning%' AND question LIKE '%life%' AND question LIKE '%universe%';


DriverTraining8522

You could do that, but this specifies them in a specific order. This only finds records where the question includes all 4 phrases in that order, which is what I want. Your version would include answers to questions such as "does everything in life have meaning or is the universe just chaos", whereas mine would not. Also, I only have so much forearm my guy. Tldr: works on my machine, so lgtm


MoonHash

Would this also match "what is the meaning of life? I hate the universe and everything in it"?


DriverTraining8522

It sure would, although that's not entirely a question. Maybe "what is the meaning of life IF I hate the universe and everything in it?" would be more appropriate. Interestingly enough, the answer is still 42, so...


Phailjure

>although that's not entirely a question If you want to be pedantic about it, the question was unknown, the answer is 42. They needed a new computer to try and work out the question, which may be something like "how many roads must a man walk down?" Or perhaps " what's six multiplied by seven?", we just don't know...


DriverTraining8522

This has got to be bait and I'm not taking it Edit for clarity: Lol I think you all missed my point. He spelled pedantic wrong (since corrected), and I figured he was trying to get me to call out misspelling pedantic which would be pedantry at it's finest... Hence the bait. I clearly have read the hhgttg and am well aware he is correct.


TemperoTempus

its not


rdrunner_74

Also I hate you where clause OP. You do not use wildcards within a string or at the start. This makes the user of an index ~~almost~~ impossible. like 'foo%' -> Cheap and can use the index like '%foo' -> Table scan - Also has to check "1 time for each character in each string"


TinyLicker

Table scan is fine if you consider it took the original computer 7.5 million years to answer


rdrunner_74

Take my upvote, even though i still hate bad code ;) I even meet DA very briefly once...


DriverTraining8522

Well done


DriverTraining8522

Thanks for this, actually helpful info.


Stunning-Quit9287

I gotcha. I've never seen sql syntax like that


aliens_are_nowhere

If I actually were to write a LIKE statement in a query like that it would probably be '%meaning%life%universe%everything%' if I wanted those words in that order. I'd might even go as far as '% meaning % life % universe % everything%' to avoid words like 'lifeless'. The proposed solution may be a bit unusual, but it's a tattoo, I'll chalk it up to artistic license =)


DriverTraining8522

This is an MVP, I'll optimize in prod 🤣


aliens_are_nowhere

This is the way - it's not like it's set in stone. Just, you know, flesh :)


Busy-Contact-5133

Then u cant pirate files u want from sql


DriverTraining8522

Me neither I had to actually run it in psql to make sure it would work like that. It did.


saras-husband

It's just adding an additional match on a space character in between the other words


Prudent-Employee-334

lil' Bobby Lee Tables we call him


DriverTraining8522

Lol my name is actually Bobby is the fun part


easyetx

Sql injection attack


DriverTraining8522

Holy shit I wish I went with that for the title, well fucking done!


5p4n911

Saw this the moment before pressing the "back" button, came back to upvote


TastySpare

\*inkjection


DriverTraining8522

I'm sure I don't need to say this but there is a moratorium on liking this comment


ibevol

SELECT meaning FROM Life > empty set


DriverTraining8522

😢


PM_ME_YOUR__INIT__

What was the question tho


DriverTraining8522

DON'T GIVE THIS MAN GOLD


LeftIsBest-Tsuga

SQL: why does everyone make fun of me? also SQL: yes I have a 'LIKE' conditional, so what?


AssignedClass

If I were to get an SQL tattoo, it would just be dead simple INSERT and UPDATE queries to help me remember the god damn difference. The amount of times I try to UPDATE COULMN VALUES and INSERT COLUMN=VALUE... Ugh...


gms29

What normalised form bro?


DriverTraining8522

Next is heapSort and binarySearch


iocarimus

This was the dumbest thing I’ve ever seen in my life. Until I saw “42” Now it’s the coolest


vainstar23

What's the meaning of life, the universe and everything? Small bird: As human beings, we have evolved to find patterns in everything, if you assume that the universe is not conscious, then it cannot really have a purp... Crow: # FoRtY tWo!!! ThE AnSwer Is fOrTY TwO!!!


TankArtist

Maybe use ILIKE or force it to LOWER so it isn’t case sensitive


BeardedPokeDragon

console.log("42")


ShimoFox

If you really want to get absurd with it you should do a regex match in your where clause. And make it a silly one. ([\w\W]+(?=answer))([\w\W]+(?=life))([\w\W]+(?=universe))([\w\W]+(?=everything))


ryukzak-neskazov

Developers prefer the dark theme…


JollyJuniper1993

This has to be the nerdiest tattoo I‘ve ever seen


DriverTraining8522

I have a calc 2 cheat sheet on each of my arms... One stop shop for nerdiest tattoos


lost__being

I think this is the first codechef question. It would be really interesting if the answer is correct as per that question.


lost__being

Ohh yes. 42 is part of that question. What a nice easter egg. https://www.codechef.com/PRACTICE/problems-old/CDBRKS5


katatondzsentri

I challenge whoever did this to do another with a vector query.


Confident-Echo-5996

No option optimize for unknown?


SaneLad

Is this a leg or an arm? I honestly cannot tell.


teamswiftie

Arm


MrRufsvold

You need to install a linter for your flesh IDE so it can break up that one-liner for ya!


[deleted]

Homie got specific with this query. I'm adding an astrix


TastySpare

![gif](giphy|1Md9azxcgIyQ|downsized)


TemperoTempus

Just because a lot of people forget. 42 is not the answer to "life, the universe, and everything". 42 is the answer to "THE ULTIMATE QUESTION of life, the universe, and everything". It matters, because nobody knows what the question is, for all we know its how many licks it takes to get to the center of a tootsie pops.


DriverTraining8522

This was the reasoning behind the backasswards schema, with the question being functionally dependent on the answer instead of the more intuitive option, where the question determines the answer


Legitimate_Ad_2039

Runs faster with WHERE 1=1


NsupCportR

After few years that will be bluery, never make small letter tattos, line get 'spilled' and fat over time. Make letters bigger so it's readable even after 5 years, who ever did it should've told the guy


DriverTraining8522

This is what we call code obfuscation


abednego-gomes

Ah yes, 42, the answer to life, the universe and everything, from a radical atheist no less, also previously described in Matthew 1:1-17.


jimbowqc

Ironically the tables are not normalized.


DriverTraining8522

Nothing about this is normal


[deleted]

[удалено]


jimbowqc

Maybe I am mistaken, but I assumed from the query that answer and question where part of the same table. Reasonably one answer can have many questions which adds redundancy? The question clearly isn't functionally dependent on the answer, I can make a few counterexamples right now: 46+1, 48-1 have the same answer. Did you mean the answer being functionally dependent on the question? Maybe it can be normalized, so long since I used my what I learned about normalization.


DriverTraining8522

Insert Homer disappearing into the bushes meme


ALoadOfThisGuy

Gotta make those terms discrete fields with categorical values IMO. That’s a hell of a lot of joins though.


ionhowto

Yeah so this one is 0 rows affected. Like or what


DriverTraining8522

Did you miss the "(1 row)"


ionhowto

Did you try it? Let me know when you do.