What if there are less than 20 distinct names that start with 'S', and we set the limit to 20?


#1

Question

In the context of this code challenge, if there are less than 20 distinct names that start with ‘S’, what happens if our LIMIT value is greater than this?

Answer

In SQL, the LIMIT statement acts as an upper bound for the number of rows that will be retrieved from the result set.

As a result, if your LIMIT value was set to 20, but there are less than 20 rows that match the query, then it will only return what is there, even if there were no matches, because LIMIT only acts as an upper bound, not a strict requirement for the amount of rows that must be returned.