How a SQL query can be complicated?