Monday 23 November 2015

Q7,p3,J15. Let E1 and E2 be two entities in ER diagram with simple single valued attributes. R1,R2 are two relationships between E1 and E2. where R1 is one to many and R2 is many to many. R1 and R2 do not have any attributes of their own.How many minimum number of tables are required to represent this situation in relational model?

Options A)4      B)3          C)2          D)1.
Answer B.
Explanation.

Let relation R1 is composed of table emp(ssn,name, Superssn). A query like this can be made from single table like. Find the employee ssn, name, super visor ssn, supervisor name from emp table. An ssn will map to a single supervisor and a supervisor can map to many employee.
In many to many relationship like  "a student can take many subjects and many students can take a subject". it needs two table.eg. student(rollno,subject,name) where pk= roll no and subject. and fk = subject.
Foreign key map to pk of subjet (Subjetid, Subjname, Roomno).
Hence it required 3 tables

No comments:

Post a Comment

Note: only a member of this blog may post a comment.