Question: Using MySQL Workbench: Create a new schema for this lab. In the Lab07DB.sql file, add a USE statement in line 1, specify the schema name

Using MySQL Workbench: Create a new schema for this lab. In the Lab07DB.sql file, add a USE statement in line 1, specify the schema name you just created. Import the data from Lab07DB.sql You will execute some commands to get information out of the database. Each bullet point represents an individual task. Index Write a query to display everything on the student table for those with a student program of Computer Science. Execute the statement as: EXPLAIN SELECT Take a screen image of the result of the EXPLAIN Create an index on the studentprogram column of the student table, give the index a name of IN_STUDENT. Paste this SQL in a Word document for later submission to Brightspace, specify this requirement number before the SQL (ii). Repeat step 2i and take a screen image of the result of the EXPLAIN. Youll notice on the first EXPLAIN output the rows value is 40. This means the DBMS had to do a full scan of the entire table, from top to bottom to search for all occurrences of the Computer Science program. Now notice the second EXPLAIN output, the rows value is now 9. This means the DBMS used the index to retreive the data (9 rows in the index). Youll also notice the key value reads the name of the index, IN_STUDENT. EXPLAIN is documented here: (https://dev.mysql.com/doc/refman/8.0/en/using-explain.html). View Create a view called computer_science_students for the SELECT created in step 2i (do not include the EXPLAIN clause). Paste this SQL in the same Word document mentioned above, specify this requirement number before the SQL (iv). Trigger Create a professor_audit_trail table. Use the code below: use ; create table professor_audit_trail ( id int unsigned primary key auto_increment not null, ProfessorName VARCHAR(255) not null, ProfessorProgram VARCHAR(255) not null ); Create a trigger on professor table which executes whenever a row in professor table is deleted. The deleted professor name and professor program should be stored in the newly created professor_audit_trail table. Note, the ID column in the audit table is NOT the ProfessorId column from the professor table. Paste the CREATE TRIGGER SQL in the same Word document mentioned above, specify this requirement number before the SQL (vi). Delete the record in the Professor table where the ProfessorId equals 10. Display the contents of the professor_audit_trail table. Take a screen image of the SQL and output, paste this image in the same Word document mentioned above, specify this requirement number before the image (viii). Drop Create the necessary DDL commands to drop the index, view and trigger. Paste these three SQL statements in the same Word document mentioned above, specify this requirement number before the SQL (ix).

Tables and colums are

-professor - professorId, professorProgram, PhoneNo, Age, ProfessorName

-student - studentno, studentprogram, phoneno, age, firstname, lastname

-student_professor - student_professor_id, professorId, StudentNo, Mentor

thanks for your help!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!