Entity-relationship Diagram Exercises And Answers Pdf Apr 2026
\draw (dept) -- (manages) node[midway, above] 1; \draw (emp) -- (manages) node[midway, below] 1; \endtikzpicture \captionCompany ERD \endfigure
\sectionExercise 6: Supertype/Subtype (Generalization) \textbfScenario: \\ A vehicle rental system tracks vehicles. A vehicle can be either a Car or a Truck. \beginitemize \item All vehicles have: VIN (PK), make, model, year. \item Cars have: number of doors, fuel type. \item Trucks have: cargo capacity (tons), number of axles. \enditemize
\documentclass[12pt,a4paper]article \usepackage[utf8]inputenc \usepackagegeometry \geometrymargin=1in \usepackagegraphicx \usepackagetikz \usetikzlibraryshapes,arrows,positioning,fit \usepackagefloat \usepackagehyperref \usepackageenumitem \usepackagetcolorbox entity-relationship diagram exercises and answers pdf
% Relationship \node[diamond, draw, aspect=2, minimum width=2cm, minimum height=1cm, below=1.2cm of $(student.south)!0.5!(course.south)$] (enroll) ENROLLS; \node[below=0.2cm of enroll, align=center] \tiny enrollment\_date;
\begindocument
\section*Appendix: Quick ERD Notation Reference \begintcolorbox \begintabularl \hline \textbfSymbol & \textbfMeaning \\ \hline Rectangle & Entity \\ Oval & Attribute (sometimes omitted, listed inside entity) \\ Diamond & Relationship \\ Underline & Primary Key \\ Double Rectangle & Weak Entity \\ Double Diamond & Identifying Relationship \\ 1 at line end & One cardinality \\ M or * at line end & Many cardinality \\ Circle (O) & Optional participation \\ \hline \endtabular \endtcolorbox
% Works-in (1 to many) \draw (dept) -- node[right] 1 ++(2,0) -- node[above] works-in ++(0,-1.5) -- node[left] M (emp); % Manages (1 to 1, but optional on employee side because not every employee is a manager) \draw[->, thick] (emp.east) -- ++(1.5,0) -- ++(0,1.5) -- node[above, midway] manages (1) (dept.east); \node at (3.5,-0.2) 1 (optional); \draw (dept) -- (manages) node[midway, above] 1; \draw
\newpage
\textbfTask: Draw an ERD with generalization (disjoint, total). \item Cars have: number of doors, fuel type
\textbfTask: Draw the ERD. Identify primary keys, entity attributes, and relationship cardinality.