MySQL has a nice feature (although non standard) which allow to query resultsets' limit, offset as
SELECT * FROM TABLE LIMIT M, N;
Is it created by MySQL? or Postgres?
What is SQL LIMIT? The SQL LIMIT clause restricts how many rows are returned from a query. The syntax for the LIMIT clause is: SELECT * FROM table LIMIT X;. X represents how many records you want to retrieve.
The SQL LIMIT clause constrains the number of rows returned by a SELECT statement. For Microsoft databases like SQL Server or MSAccess, you can use the SELECT TOP statement to limit your results, which is Microsoft's proprietary equivalent to the SELECT LIMIT statement.
The LIMIT clause is used to specify the number of records to return. The LIMIT clause is useful on large tables with thousands of records. Returning a large number of records can impact performance.
The SQL programming language was developed in the 1970s by IBM researchers Raymond Boyce and Donald Chamberlin. The programming language, known then as SEQUEL, was created following Edgar Frank Codd's paper, “A Relational Model of Data for Large Shared Data Banks,” in 1970.
According to Wikipedia, Rasmus Lerdorf (the original creator of PHP) first used the "LIMIT x" syntax in the mSQL database:
He has contributed to the Apache HTTP Server and he also came up with the LIMIT clause and added it to the mSQL Database in 1995. It is the origin of the LIMIT clauses found in MySQL and PostgreSQL.
Limiting the result set is now also standardized, but with a more verbose syntax:
SELECT *
FROM T
FETCH FIRST 10 ROWS ONLY
Postgres added the LIMIT syntax in v6.5, released on June 9th, 1999.
Based on the documentation, MySQL had LIMIT syntax starting at v3.23 (production release Jan, 2001). But the docs in the URL are for 4.1, which wasn't released until 2004.
SQL Server didn't have TOP until SQL Server 2000, shipping in late 2000.
Oracle has had ROWNUM since Oracle 6, released in 1988. Scarier still, is that it can perform better in cases than ROW_NUMBER!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With