, , ,

[SOLVED] Csci235 assignment 2

$25

File Name: Csci235_assignment_2.zip
File Size: 188.4 KB

Categories: , , , Tags: , , ,
5/5 - (1 vote)

The tasks of this assignment cover stored PL/SQL procedure, function, and trigger. The assignment covers the topics discussed in lecture 7, 8, and 9.Assignment Specification:  Preliminary actions Download SQL script dbCreateTruck-2020SP20.sql from Moodle. Execute the script to create and to load a sample database for trips made by drivers. The database contains information about the employees working for a transportation company, drivers employed by the company, trucks owned by the company, trips made by the drivers and trucks, and all legs of each trip. It is strongly recommended to discover a conceptual schema (UML diagram) of the database. However, there will be no mark awarded for producing the conceptual schema.  Implement a stored PL/SQL procedure that insert into a database full information about an employee i.e., the values of the following attributes E#, NAME, DOB, ADDRESS, HIREDATE, L#, STATUS, EXPERIENCE (only for mechanics). Your procedure should enforce a logical consistency constraint such that “the sets of drivers and mechanics must be disjoint”. It means that it is not allowed to have in the tables MECHANIC and DRIVER the rows with the same employee number (E#) and/or the same driving license number (L#). Execute your procedure twice. The first execution should insert full information about a new employee. The second execution should fail due to the violation of logical consistency constraint given above.   Hand in your solution1.lst in pdf format. Your report MUST have no errors and the report MUST list all SQL statements processed. All SQL statements of the script must be executed with SET ECHO ON, SET FEEEDBACK ON and SET SERVEROUTPUT ON options of SQL*Plus. It is a good idea to set the options at the beginning of the script. The script must be implemented with SQL*Plus. Oracle database server used for the testing and the final execution of the script is up to you. The printouts that do not satisfy the requirements listed above will score NO MARKS!     Implement a row trigger that enforces the following consistency constraint. A column totalTripMade in the relational table DRIVER is currently does not contain any value. Create a row trigger that automatically updates the values in the column (totalTripMade) when a new trip made by a driver is inserted into the relational table TRIP. Your trigger, once activated, will compute the total number of trips made by the driver and update the totalTripMade column in the relational table DRIVER. NOTE: You do not need to consider any other cases that may change the value in the column totalTripMade; that is, NO NEED to consider delete and update cases. When ready, process the SQL script solution2.sql and record the results of processing in a file solution2.lst.  Hand in your solution2.lst in pdf format. Your report MUST have no errors and the report MUST list all SQL statements processed. All SQL statements of the script must be executed with SET ECHO ON, SET FEEEDBACK ON and SET SERVEROUTPUT ON options of SQL*Plus. It is a good idea to set the options at the beginning of the script. The script must be implemented with SQL*Plus. Oracle database server used for the testing and the final execution of the script is up to you. The printouts that do not satisfy the requirements listed above will score NO MARKS!      Implement a stored PL/SQL function LONGTRIP(DLNUM) that finds the length (the total number of legs) of the longest trip performed by a driver identified by a driving license number (L# attribute in table DRIVER and parameter DLNUM parameter in the function). Remember to include or consider the drivers that performed no trips; that is to say, do not ignore drivers that do not perform any trip. If a driver has not performed any trip, then output the longest trip a 0. Use a stored function LONGTRIP in SELECT statement to list the names of all drivers together with the length of the longest trip performed by each driver.   Hand in your solution3.lst in pdf format. Your report MUST have no errors and the report MUST list all SQL statements processed. All SQL statements of the script must be executed with SET ECHO ON, SET FEEEDBACK ON and SET SERVEROUTPUT ON options of SQL*Plus. It is a good idea to set the options at the beginning of the script. The script must be implemented with SQL*Plus. Oracle database server used for the testing and the final execution of the script is up to you. The printouts that do not satisfy the requirements listed above will score NO MARKS!   This assignment is due by 9:00 pm (2100 hours) Sunday, 10 May 2020, Singapore time. Submit the files solution1.pdf, solution2.pdf, solution3.pdf through Moodle in the following way:1) Zip all the files (Solution1.pdf, solution2.pdf and solution3.pdf into one zipped folder. Name your zipped file as YourName-A3) 

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Csci235 assignment 2
$25