Search code examples
databaserelational

Relational Database


Can you do more than one clause in SQL without using aggregation and only: selection, join? Thanks.


Solution

  • If you mean having multiple WHERE's (ands), then yes.

    SELECT user.id, post.title
      FROM user LEFT JOIN post ON (post.user = user.id)
      WHERE (post.title LIKE '%Monkeys%')
        AND (user.id > 3)
        AND (user.id < 20)