adambard / adambard/learnxinyminutes-docs

[sql/en] Broaden engine support and ANSI compatibility

未關閉
#4,602 4 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Markdown
星號
12.3k
分支
3.7k
平均合併
13 小時 10 分鐘
30 天內合併 PR
6

描述

The SQL page is succinct and well designed, but I worry about the `LIMIT` clause. While supported by MySQL, MariaDB, and PostgreSQL, and SQLite, `LIMIT` is not standard ANSI SQL, and is notably not supported by Microsoft SQL Server (T-SQL).

I could submit a PR if appropriate, but would like to know if it is permissible to show two different options, for different database engines.

For instance, we could start with

`SELECT * FROM departments ORDER BY dept_name OFFSET 0 ROWS FETCH NEXT 5 ROWS ONLY;`

which is ANSI compliant and works on MariaDB, PostgreSQL, and SQL Server, then follow with something like

> Some database engines such as MySQL And SQLite do not support ORDER BY... OFFSET... FETCH... and instead implement a LIMIT clause:
>
> `SELECT * FROM departments LIMIT 5`

In related news, perhaps the whole article could lean harder toward PostgreSQL or MariaDB for compliance's sake? For instance, we could use the [Chinook sample data](https://github.com/lerocha/chinook-database/tree/master/ChinookDatabase/DataSources), instead of a sample with MySQL-only instructions.

At the end of the day, I just really want to recommend learnxinyminutes to anyone, regardless of database engine.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。