Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sql/en] Broaden engine support and ANSI compatibility #4602

Open
bowmanjd opened this issue Feb 23, 2023 · 4 comments · May be fixed by #4609
Open

[sql/en] Broaden engine support and ANSI compatibility #4602

bowmanjd opened this issue Feb 23, 2023 · 4 comments · May be fixed by #4609

Comments

@bowmanjd
Copy link

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, 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.

@nbehrnd
Copy link
Contributor

nbehrnd commented Feb 23, 2023 via email

@bowmanjd
Copy link
Author

That works for me. I can work on a PR, then let discussion stem from that. Thank you!

@bowmanjd bowmanjd changed the title [sql/en] LIMIT is non-ANSI and not universally supported [sql/en] Broaden engine support and ANSI compatibility Mar 5, 2023
@bowmanjd bowmanjd linked a pull request Mar 5, 2023 that will close this issue
6 tasks
@bowmanjd
Copy link
Author

bowmanjd commented Mar 6, 2023

I have submitted PR #4609 with a variety of changes to make the SQL instructions work across several different engines, including MySQL, MariaDB, PostgreSQL, Microsoft SQL Server, SQLite, IBM DB2, and Oracle. I welcome discussion, as there are several decisions that could be debated.

@bowmanjd
Copy link
Author

I am happy to split this PR into multiple if that would be better. Just curious if anyone has input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants