How to Select Between Ranges on MySQL
The MySQL database lets you query data between two values. These values can be decimal or integer numbers, or you can use dates to query between two date ranges. MySQL includes the Query Browser application that you can use to create your queries and review the results. You can use the software to review the data between the two ranges. Query Browser displays the raw data from your query, so you can evaluate table information directly in your database.
Instructions
-
-
1
Click the Windows "Start" button and select "All Programs." Click the MySQL program group, then click "Query Browser" to open the query software.
-
2
Click "Query" to open your editor. Type the following SQL code to create a query that filters the data between two numbers:
select * from customer where order_amount between 5.00 and 20.00
This code queries for all customers that have an order amount between 5 and 20. Click "Execute" to run the SQL and view the data in the bottom results grid.
-
-
3
Type the following code to query between two date ranges:
select * from customers where signup_date between '1/1/2010' and '12/31/2010'
This code queries all customers that signed up in the year of 2010. Click "Execute" to view the code in the results grid.
-
1