Question (Combined 4 Bank Assistant Programmer (AP) Exam: 2020 (DU)): A relationship is given below in an ER diagram. How many tables can be created (preferred) from below diagram?
a) Two
b) Three
c) Two or Three
d) No definite numbers
At the end of the last chapter you drew the COMPANY diagram: departments, employees, projects, dependents, a supervisor for each employee. (If you skipped it, the one-line picture is this: three entities DEPARTMENT, EMPLOYEE and PROJECT, a weak entity DEPENDENT, and the relationships WORKS_FOR, WORKS_ON, SUPERVISION and DEPENDENTS_OF. Part 4 draws it again.) Now the developer sitting next to you asks the practical questions. "How many tables is that? Which columns go in each? Where do the foreign keys go, and which ones may be empty?" And then the gas company's analyst arrives with a twist the plain ER model cannot draw: "We have general customers and industrial customers. An industrial customer is a customer too, with everything a general one has, plus a TAX number." This chapter answers both.
By the end you will be able to: map every ER construct to tables (strong and weak entities, composite, derived and multivalued attributes, 1:1, 1:N, M:N, ternary and recursive relationships); decide where each foreign key goes and whether it may be NULL; count the tables a diagram needs, including the minimum-and-maximum questions and the picture questions with arrows; draw the Enhanced ER (EER) constructs (superclass and subclass, specialization and generalization, disjoint or overlapping, total or partial, categories, aggregation) and map each to tables; and lay out a full written answer that goes from a story to an ER diagram to a list of tables.
Why it matters: "How many tables?" is a favourite MCQ (with and without a picture), and written papers ask "how is a many-to-many relationship converted into tables?", "convert this ER diagram into a schema" and "draw an ER diagram for this system", sometimes with general and special kinds of customer that need EER. All of it is in this chapter.