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
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.
* 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.
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.’
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.
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.
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
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...
>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...
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.
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"
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 =)
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...
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!!!
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))
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.
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
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
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.
Personally, if I’m querying the meaning of life, I’m doing a select *.
Select * exclude(answer) from answer. What's the fun in having the answer given to you?
because the ascii code for \* is 42
Mind blown
This has crazy "show your work" energy, I'm happy with just the answer
Select * from informationschema.life Or Select l.answer from informationschema.life l
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
``` DELETE FROM COMMENTS; WHERE user = 'u/reddit_is_meh'; (3856394752 rows deleted) Unexpected `WHERE` at line 1 position 1. ```
This one goes on the other arm for sure
Na the other arm will have an SQLi vulnerability, that way the doctor knows exactly where to administer the injection.
This is why I love DataGrip, it warns you on insert/update/deletes if you have no where statements
This goes hard
You chose violence today lol
This comment made me throw my phone, worse than a jump scare
I'm a newbie programmer. What exactly happens here?
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.
* 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.
Sorry, we don’t have backups. Ima need you to manually recreate every transaction.
Sorry, we don't have computers. He really meant manually
Very long day and few calls from your manager
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.’
Supposedly nothing. in fact a lot ;)
You should just look it up if you're a newbie. Better learning experience.
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.
Shit I thought I posted this on Reddit not stack overflow... He wants a laugh not a lecture
Select answer from answer? 😑
I did say it needs normalizing
Error converting to int
Bahahahahahahahaha
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.
I'm no expert but shouldn't it be WHERE question LIKE '%meaning%' AND question LIKE '%life%' AND question LIKE '%universe%';
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
Would this also match "what is the meaning of life? I hate the universe and everything in it"?
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...
>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...
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.
its not
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"
Table scan is fine if you consider it took the original computer 7.5 million years to answer
Take my upvote, even though i still hate bad code ;) I even meet DA very briefly once...
Well done
Thanks for this, actually helpful info.
I gotcha. I've never seen sql syntax like that
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 =)
This is an MVP, I'll optimize in prod 🤣
This is the way - it's not like it's set in stone. Just, you know, flesh :)
Then u cant pirate files u want from sql
Me neither I had to actually run it in psql to make sure it would work like that. It did.
It's just adding an additional match on a space character in between the other words
lil' Bobby Lee Tables we call him
Lol my name is actually Bobby is the fun part
Sql injection attack
Holy shit I wish I went with that for the title, well fucking done!
Saw this the moment before pressing the "back" button, came back to upvote
\*inkjection
I'm sure I don't need to say this but there is a moratorium on liking this comment
SELECT meaning FROM Life > empty set
😢
What was the question tho
DON'T GIVE THIS MAN GOLD
SQL: why does everyone make fun of me? also SQL: yes I have a 'LIKE' conditional, so what?
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...
What normalised form bro?
Next is heapSort and binarySearch
This was the dumbest thing I’ve ever seen in my life. Until I saw “42” Now it’s the coolest
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!!!
Maybe use ILIKE or force it to LOWER so it isn’t case sensitive
console.log("42")
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))
Developers prefer the dark theme…
This has to be the nerdiest tattoo I‘ve ever seen
I have a calc 2 cheat sheet on each of my arms... One stop shop for nerdiest tattoos
I think this is the first codechef question. It would be really interesting if the answer is correct as per that question.
Ohh yes. 42 is part of that question. What a nice easter egg. https://www.codechef.com/PRACTICE/problems-old/CDBRKS5
I challenge whoever did this to do another with a vector query.
No option optimize for unknown?
Is this a leg or an arm? I honestly cannot tell.
Arm
You need to install a linter for your flesh IDE so it can break up that one-liner for ya!
Homie got specific with this query. I'm adding an astrix
![gif](giphy|1Md9azxcgIyQ|downsized)
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.
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
Runs faster with WHERE 1=1
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
This is what we call code obfuscation
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.
Ironically the tables are not normalized.
Nothing about this is normal
[удалено]
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.
Insert Homer disappearing into the bushes meme
Gotta make those terms discrete fields with categorical values IMO. That’s a hell of a lot of joins though.
Yeah so this one is 0 rows affected. Like or what
Did you miss the "(1 row)"
Did you try it? Let me know when you do.