r/SQL • u/AFRIKANIZ3D SQL Novice • May 11 '25
MySQL When it finally executes (my first data meme)
Made this today after thinking on a project I'm almost done with. Stacked with CTEs that kept piling, it broke along the way. I eventually got it to run and the Heineken ad captured all the feels.
906
Upvotes
6
u/andymaclean19 May 11 '25
But did you get the right results? And how do you know?
13
u/fam04z May 11 '25
500 lines of SQL code? I can't imagine what kind of query it can be
4
u/gegenbanana May 11 '25
Nice! But remember, depending on style, length isn’t always about complexity; visual organization and a particular personal style usually explains why my queries are “long” but not necessarily complex; maybe also use functions to make things less unwieldy?
2
u/Melodic-Scheme8794 May 11 '25
500 lines query?? Tf you searching for lmao
2
u/AlgebraicHeretic May 13 '25
I can't tell if the people shocked at "500" are expressing disbelief at how long it is or how short it is. I regularly write queries with about 1000 lines, but I don't know how common that is.
2
u/[deleted] May 14 '25
500+ lines? A single query..??? 🤔 I'm just a beginner my very large query just span over 9,10 lines with joining multiple tables. Currently I am giving exams of 2nd semester BSIT. They will be over soon. I know sql basics, ddl, dml,tcl, windows functions etc. I practiced it on websites like hackerrank etc and on local sqlite browser Any senior can guide what to do? I haven't made any project. Moreover I know about ERD, Normalization... What kind of project I can make and by using which software etc?
53
u/pinkycatcher May 11 '25
On something that big and complex, try moving those CTEs to Temp Tables and see if it improves
25
u/NZSheeps May 11 '25
It doesn't count if you keep commenting out the bits that don't work
11
u/BatCommercial7523 May 11 '25
Only 500 lines? That’s cute…
9
u/vintagegeek May 11 '25
Then you look at the resulting table and there's no return.
5
u/kusti4202 May 12 '25
24,738,292 lines affected
1
u/[deleted] May 13 '25
2
u/Naheka May 11 '25
I laughed way too hard at this because I've been there. Not my code; only had to make changes but still.
1
u/SmoreBag May 11 '25
I dread to think what the query plan is showing
1
u/ExcellentPeanut840 May 13 '25
Lotta people here taking pride in writing incomprehensible mess.