Introduction: In previous articles i explained How to retrieve specific range of rows from SQL Server database table? and Take automatic backup of Sql server Database and How to take Sql server database backup and Delete all stored procedures from sql server database and Copy all data from one table to another in the same database in Sql Server and Date format in sql server and Start Sql server 2005/2008/2012 from command prompt?
Now in this article i am going to explain How to get/select records between specified range in SQL Server? suppose you have a EmpTable with thousands of rows and you want to retrieve some of the records based on some criteria e.g. only those records where Employee's Salary is between 10000 and 15000. There are a number of ways to get this result.I have listed two ways to get the specified result.
Now in this article i am going to explain How to get/select records between specified range in SQL Server? suppose you have a EmpTable with thousands of rows and you want to retrieve some of the records based on some criteria e.g. only those records where Employee's Salary is between 10000 and 15000. There are a number of ways to get this result.I have listed two ways to get the specified result.
- SELECT Salary , * FROM EmpTable WHERE Salary BETWEEN 10000 AND 15000 ORDER BY Salary
- SELECT Salary , * FROM EmpTable WHERE Salary >= 10000 AND Salary <=15000 ORDER BY Salary
Now over to you:
"If you like my work; you can appreciate by leaving your comments, hitting Facebook like button, following on Google+, Twitter, Linked in and Pinterest, stumbling my posts on stumble upon and subscribing for receiving free updates directly to your inbox . Stay tuned and stay connected for more technical updates."
If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..