BETWEEN operator specifies a range: determines the lower and upper bounds of qualifying values : Between AND « Select Query « SQL Server / T-SQL






BETWEEN operator specifies a range: determines the lower and upper bounds of qualifying values


1>
2> CREATE TABLE project   (project_no   CHAR(4) NOT NULL,
3>                         project_name CHAR(15) NOT NULL,
4>                         budget FLOAT NULL)
5>
6> insert into project values ('p1', 'Search Engine',        120000.00)
7> insert into project values ('p2', 'Programming Language', 95000.00)
8> insert into project values ('p3', 'SQL',                  186500.00)
9> GO

(1 rows affected)
Msg 8152, Level 16, State 14, Server JAVA2S\SQLEXPRESS, Line 7
String or binary data would be truncated.
The statement has been terminated.

(1 rows affected)
1>
2> -- BETWEEN operator specifies a range: determines the lower and upper bounds of qualifying values.
3>
4> SELECT project_name, budget FROM project WHERE budget BETWEEN 95000 AND 120000
5> GO
project_name    budget
--------------- ------------------------
Search Engine                     120000

(1 rows affected)
1>
2> drop table project
3> GO
1>
           
       








Related examples in the same category

1.Use 'Between ... and' operator on a date data type
2.'Between and' for a number data type
3.Not 'Between...and'
4.BETWEEN operator is equal to two individual comparisons, which are connected with the Boolean operator AND