Querying information in a distributed database system often involves alarge amount of data. Thus, the efficiency of the query evaluation algorithmis very important. Spark SQL is a module in Apache Spark that provides anefficient query evaluation engine for SQL queries on top of Spark. In this thesis we propose an algorithm for evaluating a combination of two semi join queries in distributed database system. The combination is the union, intersection, subtraction of two semi join queries. We also consider the intersection of two anti join queries. We implement our algorithm in Spark and we demonstrate that our algorithm offers some improvement over Spark SQL.