What database invented the syntax of the SQL query "limit"?

MySQL has a nice function (albeit not a standard one) that allows you to query the limit of the final results, offset as

SELECT * FROM TABLE LIMIT M, N; 

Is it created by MySQL? or postgres?

+6
sql mysql postgresql
source share
5 answers

Between PostgreSQL and MySQL, PostgreSQL copied the LIMIT syntax from MySQL (in version 6.5) and added the OFFSET syntax (this may have been copied, but I think mysql only had comma syntax). Then (7.2) was changed to allow the "LIMIT foo OFFSET bar" because the MySQL syntax was obscure.

+3
source share

According to Wikipedia, Rasmus Lerdorf (the original creator of PHP) first used the LIMIT x syntax in the mSQL database:

He contributed to the Apache HTTP server, and he also proposed a LIMIT clause and added it to mSQL in 1995. This is the source of the LIMIT clauses found in MySQL and PostgreSQL.

The result set restriction is now also standardized, but with more detailed syntax:

 SELECT * FROM T FETCH FIRST 10 ROWS ONLY 
+10
source share

Postgres added the LIMIT syntax in version 6.5, released on June 9, 1999 .

Based on the documentation, MySQL had the LIMIT syntax starting with version 3.2 ( release 2001, January 2001). But the docs are in the url for 4.1, which was not released until 2004.

SQL Server did not have TOP until SQL Server 2000 was submitted at the end of 2000 .

Oracle has ROWNUM with Oracle 6 , released in 1988 . However, however, it may work better than ROW_NUMBER!

+5
source share

MySQL copied it from mSQL, which Rasmus Lerdorf claims to implement: http://itc.conversationsnetwork.org/shows/detail3298.html

Not to say that mSQL was the first, but it looks like the earliest mentioned so far.

+3
source share

I know that Rdb (originally a DEC product now available from Oracle) had LIMIT TO n ROWS back in 1991.

Share and enjoy.

0
source share

All Articles