Oskar, when I talk about 'grammar' I mean the files HQL.g, HqlSqlWalker.g and SqlGenerator.g
On Sun, Feb 6, 2011 at 5:06 PM, Oskar Berggren <[email protected]>wrote: > 2011/2/6 Patrick Earl <[email protected]>: > > K, I'm going to throw a wrench in the works and add a couple options. > > > > http://en.wikipedia.org/wiki/Select_(SQL)#FETCH_FIRST_clause > > > > So, to recap: > > > > Option i: SKIPPING x TAKING y SELECT ... FROM ... WHERE ... ORDER BY ... > > Option ii: SKIP x TAKE y SELECT ... FROM ... WHERE ... ORDER BY ... > > Option iii: SELECT ... FROM ... WHERE ... ORDER BY ... SKIP x TAKE y > > Option iv: SELECT ... FROM ... WHERE ... ORDER BY ... SKIPPING x TAKING y > > > > Option v: SELECT FIRST x SKIP y ... FROM ... WHERE ... ORDER BY ... > > Option vi: SELECT TOP x SKIP y ... FROM ... WHERE ... ORDER BY ... > > Both of these seem confusing to me. Take the first 100 elements and > then skip 30, i.e. returning row 31 up to 100, that is return 70 rows? > > > Option iii seems natural to me - with skip/take close to order by, > since order by is usually vital in this situtation. > > As for grammar.... SQL sounds like commands, not a narrative. We order > the database to select some data from rows where this and that, we > also order it to skip some rows and take others. In contract, we do > not tell a story, where we describe how the db is selecting, ordering, > and skipping. So the grammar in option iii seems correct to me. > > > /Oskar > -- Fabio Maulo
