News for hackers. Stuff that matters.
Re:SQL: One of the most valuable skills by tlarkworthy on Wednesday February 13, 2019 @02:20AM (#19151097)
I think SQL is entrenched by network effects. It has a unique conceptual paradigm, which is why it is hard to learn. But any replacement is also likely to be conceptually strange, but noone is gonna put in the time in to learn something weird unless it has the adoption of SQL. This we are stuck on a local mini.a with SQL. (A pretty good one though)
Re:SQL: One of the most valuable skills by zepolen on Wednesday February 13, 2019 @04:23AM (#19151660)
It is not hard to learn - non programmers use it all the time.

Conceptually SQL is much more simple than programming, it basically reads like english:

  SELECT customer, SUM(total)
  FROM orders
  GROUP BY customer
  WHERE created BETWEEN '2018-01-01' AND '2018-12-31'`
  ORDER BY SUM(total) DESC
  
Compare that to the programming necessary to implement the above:

  totals = {}
  for row in rows:
      if row.created > '2018-12-31':
          continue
      if row.created < '2018-01-01':
          continue
      if row.customer not in customer_totals_2018:
          totals[customer] = 0
      totals[customer] = totals[customer] + row.total
  
  def _sorter((customer, total)):
      return -total
  
  for customer, total in sorted(totals.items(), key=_sorter):
      print(customer, total)
Not to mention the SQL version gets first hand knowledge on available indexes in order to speed up the query.

Now imagine adding an AVG(total) to both the SQL and programming version...