Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which database invented the "limit" SQL query syntax?

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?

like image 673
Howard Avatar asked Jun 12 '10 13:06

Howard


People also ask

What is the syntax of limit in SQL?

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.

Which database will support the limit clause?

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.

What is limit in database?

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.

When was SQL database invented?

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.


2 Answers

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
like image 63
Mark Byers Avatar answered Sep 19 '22 15:09

Mark Byers


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!

like image 41
OMG Ponies Avatar answered Sep 18 '22 15:09

OMG Ponies