0
if SQL counts from 0 then in between operator why it count from 1
means in Limit keyword we count from 0
2 odpowiedzi
0
BETWEEN conditions are inclusive, so if you specify "WHERE ID BETWEEN 0 AND 8", your return values will be for IDs 0,1,2,3,4,5,6,7,8 (or any value in between for floating-point numbers). Nine then falls outside of that range, so it would not be returned.
0
Whoops, just saw that you were referring to the limits!
Setting a limit establishes a max number of results to display. For example, SELECT TOP 5 * FROM... would check the results of your query (find matches in the table to the WHERE clause, sort by the ORDER clause, etc) and return only the resulting TOP 5!
I personally use this a LOT when reviewing logging as if I returned every match every time, my queries would take a long time to run and would load a TON of results. I generally use SELECT TOP 1000 or 500 to keep my results to a manageable level and then refine the WHERE clause further if needed.
To answer the question, the ability to 'SELECT LIMIT 0' limitation would make absolutely no sense at all. The whole purpose of a query is to have a result... If you truly don't want a result, don't write the query in the first place and you will end up with the result you want.