If there are no indexes on either of those attributes, then that is exactly what MySQL will have to do, and it can be very inefficient.
Having indexes makes all the difference in the world, though. If there is an index on S.B, for instance, then MySQL can do something more like this:
for (i=0; i<n_r; i++) { // loop over all rows in R
matching_rows = retrieve_from_index_s_b(i); // very fast operation, like direct array access
for (j=0; j<matching_rows.length(); j++)
// do some work
}
Similarly, if the index is on R.A instead, then the outer loop will be on rows in S, and the inner loop will be just on matching rows in R.
If there are indexes on both attributes, then MySQL can look at the amount of data in each table, and organize the loops so that the least amount of work is required. This is the job of the MySQL query optimizer, and it can do quite a bit of work to determine the proper order to look at tables, to minimize the number of disk accesses required.
As other people have mentioned already, though, SQL is primarily a declarative language, where you just say what results you want, without specifying how the database goes about getting those results. You can imagine that the database is always doing the full set of nested loops, if that helps you visualize the results, but as long as you have indexes set up correctly, it will usually be doing something smarter.