
Two blocks are placed at the top of the figure. Block 1 labeled ArtWorks consists of the following fields in the order placed from top to bottom. ArtWork I D, Title, Artist I D, YearOfWork. Block 2 labeled Artists is placed at the right of block 1 and consists of the following fields in the order placed from top to bottom. Artist I D, Name. A line connects block 1 to block 2 and is marked infinity at block 1 and 1 at block 2.
Statement 1 is placed below block 1 and 2 and is as follows: SELECT Artists dot Artist I D comma Title comma YearOfWork comma Name FROM Artists INNER JOIN ArtWorks ON Artists dot Artist I D equals ArtWorks dot Artist I D. Artists dot Artist I D is labeled Because the field name Artist I D is ambiguous, need to preface it with table name. Artists is labeled Table 1. INNER JOIN is labeled SQL keywords indicate the type of join. ArtWorks is labeled Table 2. Artists dot Artist I D written after INNER JOIN is labeled Primary key in Table 1. ArtWorks dot Artist I D is labeled Foreign key in Table 2.
Three blocks are placed below statement 1. Block 3 labeled Books consists of the following fields in the order placed from top to bottom. Book I D, Title, CopyrightYear. Block 4 labeled BookAuthors is placed at the right of block 3 and consists of the following fields. Book I D, Author I D. Block 5 labeled Authors is placed at the right of block 4 and consists of the following fields. Author I D, Name. A line connects block 3 to block 3 and is marked 1 at block 3 and infinity at block 4. A line connects block 4 to block 5 and is marked infinity at block 4 and 1 at block 5.
Statement 2 is placed below blocks 3, 4, and 5 and is as follows: SELECT Books dot Book I D comma Books dot Title comma Authors dot Name comma Books dot CopyrightYear FROM Books INNER JOIN open parenthesis Authors INNER JOIN BookAuthors ON Authors dot Author I D equals BookAuthors dot Author I d close parenthesis ON Books dot Book I D equals BookAuthors dot Book I d. Block 3 is connected to Books dot Book I D equals BookAuthors dot Book I d. Blocks 4 and 5 are connected to open parenthesis Authors INNER JOIN BookAuthors ON Authors dot Author I D equals BookAuthors dot Author I d close parenthesis.
Back