% Better to use explicit relationship diamond for clarity \endtikzpicture \endfigure \noindent Alternative clear diagram: \beginfigure[H] \centering \begintikzpicture \node[rectangle, draw] (dept) DEPARTMENT; \node[rectangle, draw, below=2cm of dept] (emp) EMPLOYEE; \node[diamond, draw, left=1cm of dept] (works) WORKS\_IN; \node[diamond, draw, right=1cm of dept] (manages) MANAGES;
% Course Entity \node[rectangle, draw, minimum width=2.5cm, minimum height=1cm, right=of student] (course) COURSE; \node[above=0.2cm of course] \textbfCourse; \node[below=0.1cm of course, align=center] \tiny course\_code (PK)\\ title\\ credits;
\newpage
\tableofcontents \newpage
% 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); entity-relationship diagram exercises and answers pdf
\begindocument
\textbfTask: Draw the ERD including entities, attributes, primary keys, and the many-to-many relationship with its attribute. % Better to use explicit relationship diamond for
\titleEntity-Relationship Diagram (ERD) Exercises \\ with Answers \authorDatabase Design Workbook \date\today
\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 \beginitemize \item All vehicles have: VIN (PK), make,
\newpage
\sectionExercise 5: Weak Entity Example (Order-Item) \textbfScenario: \\ An e-commerce system has orders and line items. \beginitemize \item \textbfOrder: order\_number (PK), order\_date, customer\_name. \item \textbfLine Item: item\_number (only unique per order), product\_name, quantity, price. \item A line item cannot exist without an order. The combination (order\_number, item\_number) uniquely identifies a line item. \enditemize