What's the longest SQL query you've ever seen?
one plus one
Shared publicly•View activity
View 11 previous comments
- Oh, and in response to your original question: I was getting grief from the non techies at work (luddites) about what I do or do not do, because they have no concept. So, for several months I kept chemistry style legal notes, SQL included, for all procedures and tasks I was doing. What the outcomes were, further inquiry, etc... I had to print it on 11x17 landscape, and one page was a single SQL statement that carefully ordered, assigned unique ids to based on data, and prepped for the selective summing, 'rolling up' they call it, lines of data where it was called for, and a whole separate page was a single statement to do the summing and out the data as appropriate for the needs... Blahblahblah.... No one read it. There were several other queries that took half a page. The whole first document was ~50 pages, the second about 40. They asked meto stop preparing and printing those documents, as no one read them, and there were too many copies being made. I told them they had asked me for this info about what I do. They said, 'yes, we understand. that's fine. but we're good. please don't bring those in anymore.'
America!Jul 20, 2011
- Oh yeah, and I printed in 8 point and 10 point fonts single spaced...... (varied for font of commands, vs text descriptions of procedures.)Jul 20, 2011
- Ha hah! You knew that was going to happen, right?
Either that or you explain it so well and fully that they start asking you to teach them all your tricks.
Yeah, lets get a beer and I'll make you critique my table structure!
I have one question for now: Is it generally better to taylor my queries to be precise, or to pull everything and then just sort through what I actually want on the page programmatically?Jul 21, 2011
- totally, that was most of the point.
i.e. stop. fucking. with. me.
That and if i get hit by a bus or get sick of their shit, i don't have to feel bad for just bailing as im now generally keeping notes that are pretty close. it actually proved useful to me in the end, keeping track of where i am one day to the next, and repeating things later.
honestly, depends. for scaling when you get traffic, you'll want careful stored procedures, views triggers, and timing of certain transactions. until you get too hammered, not drunk, the server... you can get away with whatever. depending on what you're deving your php with swapping queries can be easy. but overall, precise queries will give you less headaches over time. like anything else, more work now, or more work later?
also, was gonna comment earlier, to try and keep in mind crowdsourcing curation and moderation. it may not be a feature you want now, but in time, you may be very happy you had it in mind, at least, at the beginning.Jul 21, 2011
- btw the way, love the 'professional amateur scientist'. i tend to think of my self as a highly competent and skilled unfixer. Kinda similar.Jul 23, 2011
- Just ran across this post. I actually wrote a SQL statement that when printed out took 7 - 8.5x11 sheets of paper. It wasn't terribly complex once you understood what was going on. It had many Union Statements, and took 1-2 minutes to run.Nov 11, 2015