Resolved: How can I query the middle 50 rows of the expected table ?
As if my CEO wants to see the middle position report of a Databese table, How can I query the middle 50 rows of the expected table ?
Hi Shafiqul!
Thanks for reaching out.
"The middle 50 rows of the expected table" sounds somehow as too loose a statement. In other words - which 50 rows precisely? Can we be sure that the table will contain more than 50 rows? Will it contain an odd or even number of rows?
In such cases, it is better to refer to the table field containing ID information about the records, and use a BETWEEN operator in a condition to specify the rows you'd like to see.
An alternative solution would be to use Window Functions, however this is material we have not provided in the course content yet. However, we plan to do so in the next few months.
Hope this helps.
Best,
Martin