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
Concept explainers
Question
Need assistance on a MySQL question:
Create a trigger named trg_line_prod that automatically updates the quantity on hand for each product sold after a new LINE row is added.
My Query:
CREATE OR REPLACE TRIGGER trg_line_prod AFTER INSERT ON LINE FOR EACH ROW
BEGIN
UPDATE PRODUCT
SET P_QOH= P_QOH - :NEW.LINE_UNITS
WHERE PRODUCT.P_CODE = :NEW.P_CODE;
END;
Error Received:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER trg_line_prod AFTER INSERT ON LINE FOR EACH ROW BEGIN UPDATE ' at line 1
Table screenshot attached*
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 4 steps with 2 images
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
- SQL Help The Car Maintenance team wants to learn how many times each car is used in every month and day to organize their maintenance schedules. The team wants a table with the following column names and information: Car ID Month Day Count You need to create a summary table using the WITH ROLLUP modifier and grouped by the specific column names, listed above, and send the data back to the team. Query the frequency of each car's use by month and dayarrow_forwardThe BLOOD_ADMIN_INFO are ORDER ID and LINE. The MAR_ADMIN_INFO MAR_BLOOD_INFO_LN table has one row per blood unit associated with an order. Its primary key columns table has one row per medication administration. The columns ORDER_MED_ID and form the foreign key to the BLOOD_ADMIN_INFO table. Use the followin*query to answer the question below it- SELECT mar.ORDER_MED_ID, mar.SCHEDULED_TIME, mar.TAKEN TIME, bld.BLOOD_ADMIN_TYPE FROM MAR_ADMIN_INFO as mar INNER JOIN BLOOD_ADMIN_INFO as bld What join condition is appropriate in ? AS [Blood Type] Select on of the following: A. mar.ORDER_MED_ID = bld.ORDER_ID B. mar.MAR_BLOOD_INFO_LN = bld.LINE C. mar.ORDER_MED_ID = bld.ORDER_ID AND mar.MAR_BLOOD_INFO_LN = bld.LINE D. It is not possible to join these tablesarrow_forwardSQL FOR THERES TABLESarrow_forward
- Task 2: StayWell is an active business and already has some data collected over e-mails and phone conversations. You need to insert the following data to the OWNER and PROPERTY tables: Add the provided information to the OWNER table. Add the provided information to the PROPERTY table.arrow_forwardQ1Create a view named v_Title_Unavailable.The view should show the movie titles and media_id of the media not returned yet. The view should not allow any DML operationsQ2Create a SYNONYM for v_Title_Unavailable named vTU.Q3Write SQL to query the view using the synonym.arrow_forwardPLZ HELP WITH THE FOLLOWING: make the following work select MOVIE_NAME, MOVIE_YEAR from MOVIE where MOVIE_COST > (select a.MOVIE_COST from MOVIE a, PRICE b where a.PRICE_CODE = b.PRICE_CODE and b.PRICE_DESC ="weekly Special"); CREATE TABLE MEMBERSHIP ( MEM_NUM CHAR(3) CONSTRAINT MEMBER_MEMNUM_PK PRIMARY KEY, MEM_FNAME VARCHAR(30) NOT NULL, MEM_LNAME VARCHAR(30) NOT NULL, MEM_STREET VARCHAR(30), MEM_CITY VARCHAR(10), MEM_STATE CHAR(2), MEM_ZIP CHAR(5), MEM_BALANCE NUMBER(2) ); CREATE TABLE RENTAL ( RENT_NUM CHAR(4) CONSTRAINT RENTAL_RENTNUM_PK PRIMARY KEY, RENT_DATE DATE, MEM_NUM CHAR(3), CONSTRAINT RENTAL_MEMNUM_FK FOREIGN KEY (MEM_NUM) REFERENCES MEMBERSHIP ); CREATE TABLE PRICE ( PRICE_CODE CHAR(1) CONSTRAINT PRICE_PRICECODE_PK PRIMARY KEY, PRICE_DESC VARCHAR(20), PRICE_RENTFEE NUMBER (3, 1), PRICE_DAILYATFEE NUMBER(3, 1) ); CREATE TABLE MOVIE ( MOVIE_NUM CHAR(4) CONSTRAINT MOVIE_MOVIENUM_PK PRIMARY KEY, MOVIE_NAME VARCHAR(30) NOT NULL,…arrow_forward
- Task 4: The Driver Relationship team wants to have quick search options for the active drivers. The team specifically mentioned that they are using first name, last name and driving license ID to search the drivers. Create an index called NameSearch on the ACTIVE_DRIVERS table created in task 3. ASNWER IN MYSQL PLEASEarrow_forwardIn MySQL please: The Question: Create a trigger named trg_char_hours that automatically updates the AIRCRAFT table when a new CHARTER row is added. Use the CHARTER table’s CHAR_HOURS_FLOWN to update the AIRCRAFT table’s AC_TTAF, AC_TTEL, and AC_TTER values. (Hint: use temp values, as the INSERT event does not accept the OLD keyword.)arrow_forwardWithout using the MAJOR_CUSTOMER VIEW, retrieve the customer ID, first name, and last name for every customer whose credit limit is $500 or less.arrow_forward
- Insert at least three rows into your EMPLOYEE_xx table. Use the next value of the sequence you created , EMPL_SEQUENCE_xx as the value for the employee ID for every row inserted. You may choose values for the other columns Test your constraint on the rate column by trying to update a row in the EMPLOYEE_xx table with the value of 6 used for the Pay Rate (you choose the row). Drop your EMPLOYEE_xx table and make sure it HAS been purged from the recyclebinarrow_forward#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to usearrow_forwardThe OR_CASE table has one bro per surgical case. The OR_LOG table has one row per surgical log. It's LOG_ID column identifies each log. If a case has an associated log, OR_CASE.LOG_ID will store the logs ID. Otherwise, it will be null. A query uses the following join: FROM OR_CASE INNER JOIN OR_LOG ON OR_CASE.LOG_ID=OR_LOG.LOG_ID which of the following would be the results? A. A log with no associated case.B. A log with an associated case. C. A case with no associated log.D. Rows with no case or log.arrow_forward
arrow_back_ios
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