Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need only Professional experts on Database, In this project, you will be asked to enhance the COMPANY schema below by adding a new table
I need only Professional experts on Database, In this project, you will be asked to enhance the COMPANY schema below by adding a new table called COMPANYVEHICLE and linking it to the EMPLOYEE table. Using the enhanced schema, you will then be asked to write some SQL queries, views, triggers, and stored procedures. To complete this project, please follow these steps:
Use the CREATE TABLE command to create the COMPANYVEHICLE table. This table will contain the following attributes underlined attributes denotes primary key: points
Attribute Data Type
LicenseNumber VARCHAR
Model VARCHAR
Make VARCHAR
Year CHAR
Assignee CHAR: foreign key corresponding to the Ssn primary key in EMPLOYEE
Insert here the CREATE TABLE command you used to create the above table.
Use INSERT INTO command to fill the table as shown below: points
LicenseNumber Model Make Year Assignee
TEXAS ABC Mustang Ford
TEXAS RSK XJS Jaguar
TEXAS TQR Sonata Hyundai
TEXAS OPU Camry Toyota null
TEXAS FGT Cavalier Chevrolet null
TEXAS YHF Elantra Hyundai null
TEXAS TQY Avalon Toyota null
Insert here INSERT INTO commands you used to populate the table.
Create a view called V that, for each employee who was assigned a vehicle, will show the employee first name, middle initial, last name, the model, make, and year of the vehicle assigned to himher point
Insert here the CREATE VIEW command you used to create the above view and show the output of this view.
Create another view V that will show the social security number of each employee, number of projects heshe works on and the total number of hours he spent on all the projects ordered by the social security number in ascending order. That is the view should show the following information: point
Social Security Number # of Projects Total Hours
Insert here the CREATE VIEW command you used to create the above view and show the output of this view.
Mr Ahmad V Jabbar has quit the company. Use the DELETE command to delete his records from the WORKSON and EMPLOYEE tables. point
Insert here the DELETE command you used to delete the records.
Mr James E Borg has changed his address and received a salary increase. Use the UPDATE command to change his address to Thunder Rd Houston TX and increase his salary by point
Insert here the UPDATE command you used to update the address and salary.
Use the ALTER TABLE command to add a CHECK constraint to the EMPLOYEE table called salarycheck to restrict the salary so that it is in the range to Test the constraint by updating the salary of Mr James E Borg to using the UPDATE command. point
Insert here the ALTER TABLE command you used to create the above CHECK constraint. Also, the UPDATE command you used to test this constraint and a screen shot showing the error message that will be displayed.
Write a rowlevel trigger that will increase the salary of every employee that is switched to department by Test it by switching the employee Joyce English from department her current department to department points
Insert here the CREATE OR REPLACE TRIGGER command you used to create the above trigger.
Write a stored procedure called VehicleDetailsLN IN VARCHAR that has one input parameter LN which stores the license number as indicated and when called, will display details about the vehicle including model, make, year, and the manager who is currently using it The following is an example of how to call the procedure and the expected output: points
EXEC VehicleDetailsTEXAS ABC;
First NameFranklin
Last NameWong
ModelMustang
MakeFord
Year
Insert here the CREATE OR REPLACE PROCEDURE command you used to create the above procedure. Insert here a sample run of the procedure as shown above.
Write a function called ProjCountSsn char that takes as input the social security number of some employee, and returns the number of projects the employee works on Then, write an anonymous block to test this function by using for example the social security number In this case, the anonymous block should display the following message:
This employee works on projects
Submit the function and the anonymous block. Also submit a screen shot of testing the function as indicated above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started