Get the App
SLTechnology News&Howtos  ›  Database  › 

Does the sql statement between include boundary values

Shulou Source: shulou.com Published: 2022-05-31 23:37:35 09月19日 Update

Editor to share with you whether the sql sentence between includes the boundary value, I hope you will get something after reading this article, let's discuss it together!

In SQL Server, the sql statement "between and" includes boundary values, and "not between" does not include boundary values. The "BETWEEN... AND" statement selects a range of data between two values; these values can be numeric, text, or date.

BETWEEN operator

Operator BETWEEN... AND selects a range of data between two values. These values can be numeric, text, or date.

SQL BETWEEN syntax:

SELECT column_name (s) FROM table_nameWHERE column_nameBETWEEN value1 AND value2

Important matters:

BETWEEN...AND operators are handled differently in different databases. Some databases list people between "Adams" and "Carter", but not "Adams" and "Carter"; some databases list people between "Adams" and "Carter" and include "Adams" and "Carter"; others list people between "Adams" and "Carter", including "Adams", but not "Carter".

So check how your database handles the BETWEEN....AND operator!

General situation:

Between and in SQL Server includes the boundary value, and not between does not include the boundary value. However, if you use between and to limit the date, if the date after and is to the sky, then the default is 00:00:00. For example, the date after and is equivalent to 00:00:00 in 2017-04-06, so the data at 15:10:34 in 2017-04-06 is almost the same and needs to be processed by to_char.

After reading this article, I believe you have a certain understanding of "does sql sentence between include boundary value". If you want to know more about it, welcome to follow the industry information channel. Thank you for your reading!

Tags: Data boundaries between databases dates statements operators two numeric values text articles ranges processing differences important events done differences situations ways Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple Shulou Technology OPPO Reno NVidia