Number of rows that would have been returned in case of Limit in mysql
The thing is, you would have sql that have LIMIT appended at the end like
select * from sometable limit 25
but what if you wanted to know how many rows would have been returned if it was not limited?
the trivial approach is
select count(*) from sometable
and then issuing query with limit on it.
This is slower solution.
here is the way to do it in a better way
select sql_calc_found_rows * from sometable limit 25; select found_rows();
Right after execution the select with sql_calc_found_rows, we would get the ‘would have been’ value on the second query.
See how you would solve these known algorithm problems
Get maximum occurring characterFinding missing numbers from billion sequential number list file
binary tree problems with solution
Implementing tokenizer and adding tokens to the linked list
Array reversal in Recurrsion
Find longest palindrom from sequence of characters
Flatten nested javascript array
Find K Complementary numbers from array Java implementation
Check if two strings are anagrams or not
find longest word in the sentence