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
I have this and it is not showing as correct:
CREATE TRIGGER trg_updatecustbalance2
AFTER DELETE
ON INV_MYSQL FOR EACH ROW
UPDATE CUST_MYSQL
SET CUST_BALANCE = CUST_BALANCE - OLD.INV_AMOUNT;
DELETE FROM INV_MYSQL
WHERE INV_NUM = 9006;
SELECT * FROM INV_MYSQL;
Here is the question:
Write a trigger to update the CUST_BALANCE from CUST_MYSQL when an invoice is deleted from INV_MYSQL. Name the trigger trg_updatecustbalance2.
(You should delete INV_NUM 9006 from INV_MYSQL to ensure your code is correct.)
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 with 1 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
- write MySQL functions to accomplish the following tasks: A:Delete the order whose number is stored in I_ORDER_NUM. B: Change the date of the order whose number is stored in I_ORDER_NUM to the date currently found in I_ORDER_DATE. C: Retrieve and output the item number, description, storehouse number, and unit price of every item in the category stored in I_CATEGORY.arrow_forwardwrite Command to insert data into this tables create table patients ( patient_id VARCHAR(255),`name` VARCHAR(255),`insurance` DECIMAL(15,2),`date_admitted` DATE,`date_checked_out` DATE,PRIMARY KEY(`patient_id`)); create table doctor (doctor_id VARCHAR(255),name VARCHAR(255),specialization VARCHAR(255),PRIMARY KEY (doctor_id) ); create table `test` (`test_id` VARCHAR(255),`test_name` VARCHAR(255),`test_date` DATE,`test_time` TIME,`result` VARCHAR(255),PRIMARY KEY(`test_id`)); create table doctor_patient( patient_id VARCHAR(255), doctor_id VARCHAR(255),PRIMARY KEY(`patient_id`),FOREIGN KEY(`doctor_id`) REFERENCES doctor(`doctor_id`) ); create table test_log (`test_log_id` varchar(255),`patient_id` VARCHAR(255),`test_id` VARCHAR(255),`doctor_id` VARCHAR(255),`comments` VARCHAR(255),PRIMARY KEY(`test_log_id`),FOREIGN KEY(`test_id`) REFERENCES `test`(`test_id`),FOREIGN KEY(`patient_id`) REFERENCES doctor_patient(`patient_id`),FOREIGN KEY(`doctor_id`) REFERENCES doctor(`doctor_id`));arrow_forwardWhat distinguishes embedded system software from other types of system software? Provide some examples of each. To what extent can an Embedded application function independently of the System software is the question at hand. How?arrow_forward
- For this query (select name,female_literacy_rate from country INNER JOIN education on country.CIode2 = education.country_code;) I ran it and I got the error as shown in the attached image.arrow_forwardThere is no language attribute in the table So Not able to run any query. this is what I have in the table .hopefully that will help to solve this part. DROP TABLE IF EXISTS `CountryLanguage`; CREATE TABLE `CountryLanguage` ( `CountryCode` char(3) NOT NULL DEFAULT '', `Language` char(30) NOT NULL DEFAULT '', `IsOfficial` enum('T','F') NOT NULL DEFAULT 'F', `Percentage` float(4,1) NOT NULL DEFAULT '0.0', PRIMARY KEY (`CountryCode`,`Language`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `CountryLanguage` -- -- ORDER BY: `CountryCode`,`Language` INSERT INTO `CountryLanguage` VALUES ('AFG','Balochi','F',0.9); INSERT INTO `CountryLanguage` VALUES ('AFG','Dari','T',32.1); INSERT INTO `CountryLanguage` VALUES ('AFG','Pashto','T',52.4); INSERT INTO `CountryLanguage` VALUES ('AFG','Turkmenian','F',1.9); INSERT INTO `CountryLanguage` VALUES ('AFG','Uzbek','F',8.8); INSERT INTO `CountryLanguage` VALUES ('DEU','German','T',91.3); INSERT INTO `CountryLanguage` VALUES…arrow_forwardMake sure that the SQL script file can be run successfully in MySQL and show the outcome of the whole code on MySQL pleasearrow_forward
- Beta MySQL Main.sql X HN34567 2 7 ); @paiza.io MySQL Online CREATE TABLE BOOK_STORES ( Store_ID NUMBER(8) NOT NULL, Name VARCHAR2(30) UNIQUE NOT NULL, Contact VARCHAR2(30), Rep_ID VARCHAR2(5), PRIMARY KEY(Store_ID) Run (Ctrl-Enter) Enter a title here New code Name VARCHAR2(30) UNIQUE NOT NULL, Contact VARCHAR2 (30),' at line 2 Recent code WebDev Runtime error(Exit status:1) English ▼ Sign Up Sign In (1.38 sec) Output Runtime error Input Comments 0 ERROR 1064 (42000) at line 2: 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 'NUMBER (8) NOT NU LL,arrow_forwardA summarize table can be edited in Transform Data? True Falsearrow_forward. Write a T-SQL correlated subquery selecting the store code, store name, store ytd sales from the store table where the store code matches the selection result of the max store code from the store table where the store code matches. /* Created with SQL Script Builder v.1.5 */ /* Type of SQL : SQL Server */ CREATE TABLE EMPLOYEE ( EMP_CODE int, EMP_TITLE varchar(4), EMP_LNAME varchar(15), EMP_FNAME varchar(15), EMP_INITIAL varchar(1), EMP_DOB datetime, JOB_CODE varchar(5), STORE_CODE int ); INSERT INTO EMPLOYEE VALUES('1','Mr.','Williamson','John','W','5/21/1964','SEC','3'); INSERT INTO EMPLOYEE VALUES('2','Ms.','Ratula','Nancy','','2/9/1969','MGR','2'); INSERT INTO EMPLOYEE VALUES('3','Ms.','Greenboro','Lottie','R','10/2/1961','GEN','4'); INSERT INTO EMPLOYEE VALUES('4','Mrs.','Rumpersfro','Jennie','S','6/1/1971','GEN','5'); INSERT INTO EMPLOYEE VALUES('5','Mr.','Smith','Robert','L','11/23/1959','GEN','3'); INSERT INTO EMPLOYEE…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