120 likes | 138 Views
Solutions to exercises from Lecture 4. ER Modeling I handout - Q1. DIVISION ( DivisionID ,… ManagerID ) DEPARTMENT ( DeptID ,… DivisionID ) EMPLOYEE ( EmpID , … DeptID ) PROJECT ( ProjectID ,…) EMPLOYEE_PROJECT ( EmpID , ProjectID ,…). not null. null allowed. ER Modeling I - Q2.
E N D
ER Modeling I handout - Q1 • DIVISION (DivisionID,…ManagerID) • DEPARTMENT (DeptID,…DivisionID) • EMPLOYEE (EmpID, …DeptID) • PROJECT (ProjectID,…) • EMPLOYEE_PROJECT (EmpID, ProjectID,…) not null null allowed
ER Modeling I - Q2 • INSTRUCTOR (InstructorID, HighestDegree, …) • COURSE (CourseID, ClassTitle, …) • CLASS (ClassID, CourseID, InstructorID, Term…) • TRAINEE (TraineeID, …) • ENROLL (TraineeID, ClassID, Term…)* * Optionally, create an EnrollmentID attribute to use as primary key. All foreign keys not null.
ER Modeling I - Q3 • CUSTOMER (CustomerID, …) • INVOICE (InvoiceID, CustomerID, SalesRepID,…) • LINE (InvoiceID, LineID, ProdID,…) • PRODUCT (ProductID, …) • SALESREP (SalesRepID, …) • VENDOR (VendorID,…) • SHIP (ShipID, ProductID, VendorID,…) All foreign keys not null
ER Modeling I - Q4 • AGENT (AgentID, LName, Region…) • CLIENT (ClientID, LName,…) • MUSICIAN (MusicianID, AgentID, Name, DaysAvailable,…) • EVENT (EventID, ClientID, MusicianID, Date, Time, Location…) • INSTRUMENT (InsturmentID, …) • MUSICIAN_INSTRUMENT (MusicianID, InstrumentID, YearsExperience…) All foreign keys not null.
ER Modeling I - Q5 • CITY (CityID, …) • TEAM (TeamID, CoachID, CityID, …) • PLAYER (PlayerID, TeamID,…) • COACH (CoachID, TeamID,…) • GAME (GameID, HomeTeamID, VisitorTeamID,…) All foreign keys not null.
ER Modeling II - Q1 • COMPANY (CompanyID, …) • DEPARTMENT (DepartmentID, CompanyID…) • EMPLOYEE (EmployeeID, DepartmentID, …) • DEPENDENT (EmployeeID, DependentID, …) • EMPLOYEE_HISTORY (EmployeeID, HistoryID, …) All foreign keys are not null
ER Modeling II - Q2 • MEMBER (MemberID, …) • WORKOUT (WorkoutID, MemberID, Date…) • EXERCISE (ExerciseID…) • WORKOUT_EXERCISE (WorkoutID, ExerciseID, NumberSets, NumberReps,…)
ER Modeling II - Q3 • EMPLOYEE (EmployeeID, Name…PositionID) • PART_TIME_EMPLOYEE (EmployeeID, HourlyRate…) • FULL_TIME_EMPLOYEE (EmployeeID, Salary, OfficeRoom, …) • POSITION (PositionID, Title, Job_Description…) All foreign keys not null.
ER Modeling II - Q4 • USER (UserID, Name, Department,…) • PROBLEM (ProblemID, TimeSpent, UserID, ResolverID,…) • HARDWARE (ProblemID, Description, Solution…) • SOFTWARE (ProblemID, SoftwareVersion, …) • RESOLVER (ResolverID, Name, Phone, Level, …) All foreign keys not null.
ER Modeling II - Q5 • EMPLOYEES (EmployeeID, SupervisorID, …) • SKILLS (SkillID, SkillName, …) • EMPLOYEE_SKILL (EmployeeID, SkillID, DateAcquired, Certification,…) • PROJECTS (ProjectID, ProjectName, ManagerID, StartDate…) • EMPLOYEE_PROJECT (EmployeeID, ProjectID, Role…) • PROJECT_SKILL (ProjectID, SkillID, SkillLevelRequired, NumberStaff,…)* • DEPENDENTS (EmployeeID, DependentID, DateOfBirth…) • WORK_HISTORY(EmployeeID, HistoryID,…) • BENEFITS (BenefitID, BenefitType, Company, Contact,…) • EMPLOYEE_BENEFIT (EmployeeID, BenefitID,…) * Optionally, create a ProjectSkill_ID attribute to use as primary key. All foreign keys are not null.
ER Modeling II - Q6 • ORCHARD (OrchardID, Location, …) • SPECIES (SpeciesID, Name, OrchardID…) • DISEASE (DiseaseID, Symptoms, Treatment,…) • SPECIES_DISEASE (SpeciesDiseaseID, SpeciesID, DiseaseID, Date,…)* • CUSTOMER (CustomerID, …) • ORDER (OrderID, CustomerID, …) • ORDERDETAILS (OrderID, DetailID, SpeciesID,…) * Optionally, use the combination of SpeciesID, DiseaseID and Date as primary key and remove SpeciesDiseaseID entirely. All foreign keys not null.