Use MySQL Workbench for these questions. Do NOT use Lucidchart. MySQL Workbench has more capability than Lucidchart, as it allows creation of DDL SQL from the model. Turn in 1 Workbench file , 1 document with the forward-engineered sql statements, and a Word document with your inserted data.
This problem mimics the one from the previous assignment. Model it in Workbench, then forward-engineer the database script and import into your database. If the import fails, fix it in the model, then try again.
A. Create the tables DEPARTMENT, EMPLOYEE, COMPUTER, and VEHICLE. Add the primary key field(s) and at least 2 non-key fields to each table that are relevant to that table (ie. PhoneNumber would be valid for EMPLOYEE). Use your model from the previous assignment to create the tables in Workbench.
B. Draw the relationships between the tables. Assume that a DEPARTMENT does not need to have an EMPLOYEE, but that every EMPLOYEE is assigned to a DEPARTMENT. The employee is assigned a laptop (COMPUTER) for his/her use, and it is not to be shared with other employees. The employee checks out a VEHICLE, but is not guaranteed a specific vehicle. So on different days, the employee may be driving a different vehicle.
C. Use the inserts tab under the table to add relevant data to the tables. Note: The inserts tool does NOT validate your data. For instance, if a field is set up as a numeric field, and you enter a letter, you will not receive an error until you actually run the script to insert the data in the table.
Make sure the business rules are met by inserting specific data:
A: Try to assign 2 employees to the same department.
B: Try to assign 2 computers to 1 user, and 2 users to 1 computer. (This should fail in step 1e below. Fix the model and/or the data before submitting).
C: Try to assign an employee to 2 vehicles, and a vehicle to 2 employees.
D. Forward-Engineer the database, and make sure to check “Generate INSERT Statements for Tables.” In the “Review the SQL Script to be Executed” screen, click “Save To File…” Choose a name like “A11.sql”.
E. If the script fails, fix the model and/or the insert data, forward-engineer the script again, then re-run the script. Do this until you don’t have any errors.
F. Once the script executes successfully, go back to the model and copy the data from each table into a Word document. The data should paste in as a table. To copy data from Workbench, open the Inserts tab from C above. Select all data by clicking on the area above and to the left of the table (see example right). Type Ctrl-C to copy the data. Paste it into a Word document. Continue with all of the tables. Save the document to a file like “A11.docx”.