0

I'm learning database. I came across LIMIT keyword and its usage. In some tutorial it was specified as

LIMIT row_number OFFSET n will select row_number of rows after skipping n rows

And in another tutorial it was written as

LIMIT offset, row_number will select row_number of rows after skipping offset rows

Now which syntax is correct, if both are correct then where to use what?

trim24
  • 250
  • 3
  • 12

2 Answers2

2

LIMIT row_number OFFSET n syntax is for MySQL, PostgreSQL and SQLite

LIMIT offset, row_number is for MySQL

Microsoft SQL Server uses a completely different approach: https://stackoverflow.com/a/10440718/234661

Oracle is similarly difficult: https://stackoverflow.com/a/26051830/234661

FirebirdSQL uses 2 methods. The recommended one is ROWS m TO n: https://firebirdsql.org/refdocs/langrefupd20-select.html#langrefupd20-select-rows

They are different because they haven't been standardized before being implemented.

Alex
  • 13,774
  • 5
  • 40
  • 58
0

Both are same as they are generating same results.

The difference is only when you use second one LIMIT offset, row_number There is only syntax difference

You can use any of them based on your requirements

M.suleman Khan
  • 540
  • 5
  • 17