A one of my co-workers today said he once witnessed a 20,000 line SQL query. Is that even a thing? What does it do?

  • 0
  • 5
    What if he meant a query that returned 20000 records? That'd sound a lot more reasonable to meπŸ˜…
  • 0
    @Bl00D4NGEL what he said wasn't that reasonable.
  • 4
    That sounds like it had to join every table in a huge database with aggregate functions that did calculations. I bet that was for
    Data Analyst not production use and hopefully a script not a human wrote it.
  • 1
    I once wrote a code that generated a few thousand lines of a single SQL query (standard SQL). It was big mainly because it had a few hundred columns, and was basically a pivot table. Nothing complicated about it.

    If all of those lines were just joins and subqueries, unless it's a small DB, it would execute until 2023 or something.
  • 2
    And I thought the 150 line sql query I have was overly big, I see my standards are to low now πŸ˜‚
  • 1
    #ProgrammingUrbanLegend πŸ€”
  • 6
    Probably the name of the table was 19999 line long and all the query did was select * ???

    Quite possible..
  • 0
    And the table name was wrong 😨
Add Comment