News for hackers. Stuff that matters.
Re:Shouldn't FROM come before SELECT in SQL? (2011) by hn92726819 on Thursday January 25, 2024 @05:54PM (#39136571)
I wonder if there is a concept of infinite length SQL tables. Not sure what would happen with:

    ORDER DESC
    COUNT(*)
I can't find anything after a quick search except recursive views that must terminate (therefore aren't infinite)
Re:Shouldn't FROM come before SELECT in SQL? (2011) by jasomill on Friday January 26, 2024 @12:19AM (#39139188)
COUNT is easy:

  > SELECT COUNT(*) FROM ℤ;
  ℵ₀
  > SELECT COUNT(*) FROM ℝ;
  POWER(2,ℵ₀)
  > EXEC sp_configure 'continuum hypothesis','1';  
  > RECONFIGURE;
  > SELECT COUNT(*) FROM ℝ;
  ℵ₁
While non-termination is probably best left implementation-defined (to allow caller-terminated streams of infinite results where they make sense), ORDER BY would clearly be an error where no well-defined "first" or "next" result exists.
Re:Shouldn't FROM come before SELECT in SQL? (2011) by wlindley on Friday January 26, 2024 @09:27AM (#39142942)
How fun it would be to receive a Cantor result in which as many elements from the original set as there were have been removed, leaving a set drawn from what you started with which still contains as many elements!