relational algebra for Limit Operator

relational-algebra, sql

Solution

About the `limit` in relational algebra. Traditional relational algebra does not support anything like the `limit` in SQL. This problem has been recognized and studied by Li, Chang, Ilyas and Song in RankSQL: query algebra and optimization for relational top-k queries (SIGMOD 2005). They have proposed a monotonic scoring function F that ranks the results by the sorting operator tauF.

Problem

What is relational algebra for these two SQL queries: ``` Select * from film where film_rating = 'PG' limit 20; ``` How can we show limit? ``` Select * from actor, country where first_name='BOB' and country='In'; ``` where first_name is actor's column and country is country table's column...there is no relationship between these two tables...they are independent tables... so can we use join operator here?

Original source