M cheung william tan and carson woo 28 demonstrating

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 335 Copyright © 2009-10 Y.M. Cheung, William Tan and Carson Woo 28 Demonstrating One-to-Many Relationship Relationship One-to-Many Relationships Table Name: Painter P_NUM LastName 123 Ross 126 FirstName Initial Georgette Itero Julio P. • Assign the primary key of Can I represent the information this way? the one (i.e. parent table) to the one (i.e. parent table) to the many (i.e. child table) P_NUM • The P_NUM field iin the field n the (PK) (PK) (FK) PNT_NUM TITLE P_NUM 1338 Dawn Thunder 123 1339 Roses in Vase 123 1340 The Founders Hasty Exit 126 Initial Georgette P. 1338 Dawn Thunder 1339 Roses in Vase Itero Julio G. 1340 The Founders 1341 Hasty Exit Table Name: Painting Name: Painting BUSI 335 PNT_NUM TITLE PNT_NUM2 TITLE2 Copyright © 2009-10 Y.M. Cheung, William Tan and Carson Woo BUSI 335 TITLE 123 Ross Georgette P. 123 Ross Georgette P. 126 Itero 126 Itero Julio Julio G. G. Copyright © 2009-10 Y.M. Cheung, William Tan and Carson Woo 30 Demonstrating Many-to-Many Relationship Relationship • How would you store the fact that a S_Num S_Name 321452 Samuel Johnston 344511 Lindsay Odger Odger student student enrolls in more than one course and that one course can accept more than one student? more than one student? CR# Course 1321 Intro. to Database 1322 Systems Analysis Analysis How do you store information on which student took which course? • What about one employee participating What about one employee participating in more than one project and one project being undertaken by more than one one employee? Copyright © 2009-10 Y.M. Cheung, William Tan and Carson Woo Initial 1340 The Founders 1341 Hasty Exit Exit 29 FirstName 1339 Roses in Vase The foreign key does not have to be part of primary key to be part of a primary key. P_NUM LastName 1338 Dawn Thunder Many-to-Many Relationships Relationships BUSI 335 PNT_NUM Or this way? 126 1341 Painting table is called a foreign key whose value must match the primary key value of the parent table FirstName Ross 126 G. LastName 123 Where would you store a stu...
View Full Document

This document was uploaded on 03/04/2014 for the course COMM 335 at The University of British Columbia.

Ask a homework question - tutors are online