VIEW

Views: Old Testament and New Testament

Views are virtual tables and can save you much typing on common queries. They're new to MySQL 5.0, and pretty simple to learn.

The bible table includes both old and new testaments. Suppose you wanted to find lines about Adam, but limit your query to just the old testament. You could join on the books table like so...

    SELECT bb.id, book, cap, verse, line
      FROM bible as bb
INNER JOIN books as bk ON (bb.book = bk.abbr)
     WHERE bk.volume = 'Old Testament'
       AND line LIKE '%Adam%';
Syndicate content