The SQL WHERE BETWEEN syntax
The general syntax is:
- SELECT column–names
- FROM table–name
- WHERE column–name BETWEEN value1 AND value2
SQL WHERE BETWEEN Examples
Problem: List all products between $10 and $20
- SELECT Id, ProductName, UnitPrice
- FROM Product
- WHERE UnitPrice BETWEEN 10 AND 20
- ORDER BY UnitPrice
Results: 29 records.
Id | ProductName | UnitPrice |
---|---|---|
3 | Aniseed Syrup | 10.00 |
21 | Sir Rodney’s Scones | 10.00 |
74 | Longlife Tofu | 10.00 |
46 | Spegesild | 12.00 |
31 | Gorgonzola Telino | 12.50 |
![]() |
Problem: List all products not between $10 and $100 sorted by price.
- SELECT Id, ProductName, UnitPrice
- FROM Product
- WHERE UnitPrice NOT BETWEEN 5 AND 100
- ORDER BY UnitPrice
Results: 4 records.
Id | ProductName | UnitPrice |
---|---|---|
33 | Geitost | 2.50 |
24 | Guaraná Fantástica | 4.50 |
29 | Thüringer Rostbratwurst | 123.79 |
38 | Côte de Blaye | 263.50 |
Problem: Get the number of orders and amount sold between Jan 1, 2013 and Jan 31, 2013.
- SELECT COUNT(Id), SUM(TotalAmount)
- FROM [Order]
- WHERE OrderDate BETWEEN ‘1/1/2013’ AND ‘1/31/2013’
Results:
Count | TotalAmount |
---|---|
33 | 66692.80 |
핑백: w88 lite
핑백: Pinball Machines for Sale
핑백: Facebook Marketing
핑백: nằm mơ thấy núi lửa
win money to remodel your home
핑백: 안전놀이터
win money instantly online free
win money
google ads
핑백: DevOps strategy
핑백: mơ thấy kim cương
핑백: mơ đánh vợ
핑백: mơ gãy răng cửa
핑백: Stiiizy starter kit
핑백: tính cách cung bảo bình nữ
핑백: mơ thấy đi chùa
핑백: Harold Jahn Canada
핑백: tai game dua ngua
핑백: cvv dumps
핑백: mo thay di chua
핑백: Cornhole Shop
핑백: nằm mơ thấy tóc bạc
핑백: mơ thấy con trâu đánh đề con gì
핑백: nằm mơ thấy bướm
핑백: lions cornole board game
핑백: ตู้แปลภาษา
핑백: mơ thấy con ngựa
핑백: mơ thấy nhà xí
핑백: mo thay be gai
핑백: mơ thấy gái đẹp đánh con gì
핑백: Digital Transformation
핑백: Cooler Master Sentinel Advance manuals
핑백: https://boccadentalspa.com
핑백: windshield replacement Springfield IL
핑백: เซ็กซี่บาคาร่า
핑백: syarat cpns kemendikbud 2022