Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
I am stuck on a question. Please assist with writing this code:
- Create a trigger for the EMPLOYEES table that will set the commission amount to .4 whenever the department_id is 80. Test your trigger COMPLETELY for every event it is defined. (Sometimes, UPDATE statements must have UPDATE tablename on a separate line by itself to keep APEX from hanging). This should work both for new rows and existing rows that are updated. Scenerio: All employees who are in the sales department (80) will have their commission always set to .4. This trigger is to enforce this business rule automatically.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- //stored procedure create or replace procedure firstthree (my_seqid in varchar2) as cursor c1 is select sname, grade from student s join taken t on s.sid=t.sid where seqid=my_seqid order by grade desc; -- my_sname varchar2(40); my_sname student.sname%TYPE; -- my_grade number(2,1); my_grade taken.grade%TYPE; begin /* clear the my_tmp table */ delete from my_tmp; commit; open c1; for i in 1..3 loop fetch c1 into my_sname, my_grade; exit when c1%notfound; /* in case the number requested */ /* is more than the total */ /* number of enrolled students */ /* display the result */ dbms_output.put_line('name: ' || my_sname || ' ' || 'grade: ' || my_grade); /* put into temporary table */ insert into my_tmp values(my_sname, my_grade); commit; end loop; close c1; end; / -------------- //php <? $connection = oci_connect ("test", "test", "test"); if ($connection == false){ $e = oci_error();…arrow_forwardTask 1: The InstantRide received some traffic violation tickets from the government. The Legal team of InstantRide requires the travel information of the respective drivers along with corresponding Driving License IDs to proceed further. In addition, the team wants to include the drivers without travel information in the system yet for the completion of driver list. Therefore, you need to return DRIVER_FIRST_NAME, DRIVER_LAST_NAME, DRIVER_DRIVING_LICENSE_ID, TRAVEL_START_TIME, TRAVEL_END_TIME information from the DRIVERS and TRAVELS data connected by LEFT JOIN. Task: Query all drivers with and without travel data. (SQL Database Test)arrow_forwardUse Visual Studio to create a database named Personnel.mdf. The database should have a table named Employee, with columns for employee ID, name, position, and hourly pay rate. The employee ID should be the primary key. Insert at least five sample rows of data into the Employee table. Create an application that displays the Employee table in a DataGridView control.arrow_forward
- Create a formula that provides the start date of a project as follows: In cell H4, begin to enter a formula using the INDEX Use the Lookup table (range A2:E23) as the array. For the row_num argument, use the MATCH Use the Project ID (cell H2) as the lookup_value for the MATCH function. Use the ID column (range A2:A23) as the lookup_array for the MATCH function. Specify an exact match (0) for the MATCH function. Use the Start Date column (column 4) as the column_num for the INDEX function.arrow_forwardPlease write a view to list staff’s names, salary, ages, and their supervisors’names, salary, and ages for all staff whose supervisor’s age is younger than the staff’s age and theirsupervisor’s salary is higher than the staff’s salary. You should use Staff2 table. The output headerneeds to distinguish between staff and manger: (E_name, E_salary, E_age, M_name, M_salary, M_age)arrow_forwardQ2:Write a row-level trigger that executes before updating a project’s location in the project table. The trigger changes the department number of the project to 4 if the location is in ‘Stafford’. SQLarrow_forward
- Task 4: The InstantRide User Satisfaction team is a core team for InstantRide, and they focus on increasing the customer satisfaction. They want to learn the travel time for each ride in the system. You need to return the USER_ID, and the TRAVEL_TIME column which is calculated using the TIMEDIFF function on the TRAVEL_END_TIME and the TRAVEL_START_TIME.arrow_forwardThe Save Transaction button depicted in the screen attached is used to save relevant data to the sales table and the salesdetails tables from the depicted schema. When this button is clicked it calls the saveTransaction() function that is within the PosDAO class, it passes to this function an ArrayList of salesdetails object, this list contains the data entered into the jTable which is the products and qty being sold.Write the saveTransaction function. You are to loop through the items and get the total sales, next you are to insert the current date and the total sales into the sales table. Reminder that the sales table SalesNumber field is set to AUTO-INCREMENT, hence the reason for only entering the total sales and current date in sales table.arrow_forwardTask 2: The Car Maintenance team also wants to store the actual maintenance operations in the database. The team wants to start with a table to store CAR_ID (CHAR(5)), MAINTENANCE_TYPE_ID (CHAR(5)) and MAINTENANCE_DUE (DATE) date for the operation. Create a new table named MAINTENANCES. The PRIMARY_KEY should be the combination of the three fields. The CAR_ID and MAINTENANCE_TYPE_ID should be foreign keys to their original tables. Cascade update and cascade delete the foreign keys. SQL DataBase Test: Create a new table to store maintenance operations Test Query: DESCRIBE MAINTENANCES Expected Results Field Type Null Key Default Extra CAR_ID char(5) NO PRI NULL MAINTENANCE_TYPE_ID char(5) NO PRI NULL MAINTENANCE_DUE date NO PRI NULLarrow_forward
- First normal form says: a. No nonkey columns depend on another nonkey column b. Every column that's not part of the primary key is fully dependent on the primary key. c. Eliminate repeated fields. d. None of the abovearrow_forwardStayWell’s maintenance team wants to recheck the apartments that had plumbing service requests beforehand. You will need to return all the property IDs and the addresses of the properties that had plumbing service request (CATEGORY_NUMBER 1). Task Return a list of all the property IDs and the addresses of the properties that had plumbing service requests.arrow_forwardCreate a trigger named Products_UPDATE that checks the new value for the DiscountPercent column of the Products table. This trigger should raise an appropriate error if the discount percent is greater than 100 or less than 0. If the new discount percent is between 0 and 1, this trigger should modify the new discount percent by multiplying it by 100. That way, a discount percent of .2 becomes 20. Test this trigger with an appropriate UPDATE statement.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education