As someone who comes from the world of Object Orientation, I find it rather difficult to wrap my head around SQL. Recently, however, I realized that the classical SQL construct
select X from Y where Z
is basically equivalent to the following OOP construct:
List<SomeType> results = db.query(new Matcher<SomeType> () {
public boolean match(SomeType candidate) {
return ...; // checks condition Z on candidate, returns true for match
}
};
So my question is: What are the OOP equivalents for other SQL constructs, such as joins?