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

Replace all uses of BETWEEN #4

Open
schuemie opened this issue Nov 9, 2018 · 3 comments
Open

Replace all uses of BETWEEN #4

schuemie opened this issue Nov 9, 2018 · 3 comments

Comments

@schuemie
Copy link
Member

schuemie commented Nov 9, 2018

Several queries use the SQL operator BETWEEN, for example this query. Even though this translates without error to the different SQL dialects, it means different things. In some dialects the start and end dates are included. In some dialects the end date isn't included, etc. It is better to be explicit, so instead of

WHERE my_date BETWEEN start_date AND end_date

we should use

WHERE my_date >= start_date AND my_date <= end_date
@PRijnbeek
Copy link
Collaborator

Agree. How do we make the community aware of these type of best practices?

@schuemie
Copy link
Member Author

schuemie commented Nov 9, 2018

The SqlRender vignette might be a good place to capture best practices related to writing SQL that translates properly to the different dialects?

@PRijnbeek
Copy link
Collaborator

Yes absolutely.

AnthonyMolinaro referenced this issue in EHDEN/QueryLibrary Feb 28, 2019
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

No branches or pull requests

2 participants