1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Pepsi [2]
3 years ago
8

Write a script that creates and calls a stored procedure named test. This procedure should use a transaction that includes the s

tatements necessary to combine two customers. These statements should do the following: Select a row from the Customers table for the customer with a customer_id value of 6. This statement should lock the row so other transactions can’t read or modify it until the transaction commits, and it should fail immediately if the row is locked from another session. Update the Orders table so any orders for the selected customer are assigned to the customer with a customer_id value of 3. Update the Addresses table so any addresses for the selected customer are assigned to the customer with a customer_id value of 3. Delete the selected customer from the Customers table. If these statements execute successfully, commit the changes. Otherwise, rollback the changes.
Computers and Technology
1 answer:
natita [175]3 years ago
8 0

Answer:

Check the explanation

Explanation:

use `my_guitar_shop`;

#delete the procedure test if it exists.

DROP PROCEDURE IF EXISTS test;

DELIMITER //

CREATE PROCEDURE test ()

BEGIN

   #declare variable sqlerr to store if there is an sql exception

  declare sqlerr tinyint default false;

   #declare variable handler to flag when duplicate value is inserted

  declare continue handler for 1062 set sqlerr = TRUE;

   #start transaction

   start transaction;

  delete from order_items where order_id in

      (select order_id from orders where customer_id=6);

  delete from orders where customer_id=6;

  delete from addresses where customer_id=6;

  delete from customers where customer_id=6;

 

   if sqlerr=FALSE then

      commit;

        select 'Transaction Committed' as msg;

  else

       rollback;

       select 'Transaction rollbacked' as msg;

   end if;

end //

delimiter ;

call test();

You might be interested in
Coordinate with
Lunna [17]

Answer:

First blank: producer

Second blank: Hairdressers

5 0
3 years ago
What was the first 1.0.1 version of openssl that was not vulnerable to heartbleed?
vovikov84 [41]
I suggest you to read OpenSSL changelogs to make it more clear. As there's not enough space to describe how it works. But heartbleed resistan version was 1.0.2, as I know.
5 0
3 years ago
Read 2 more answers
Given the following MIPS Code Fragment:
galben [10]

Answer:

There are 3 Data Hazard

Explanation:

Find attached the solution

6 0
3 years ago
What two characteristics describe an ftp connection?.
Brrunno [24]
The first connection established is for traffic control and the second is created for transfer of a file.

Please mark as brainlest answers
5 0
3 years ago
What is the correct html element for playing video files?
Neko [114]
HTML stands for Hyper Text Markup Language. It is the most commonly language used for <span>creating web pages and web applications. </span>

<span>The correct HTML element for playing video files is <video>.
</span>

To show a video in HTML, use the <video> element:

Example:<span><video<span> width="320" height="240" controls</span>></span>
  <span><source<span> src="video 1.mp4" type="video/mp4"</span>></span>
  <span><source<span> src="movie.ogg" type="video/ogg"</span>></span>
<span></video<span>></span></span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • Where are Micro USB connectors used the most?
    11·2 answers
  • Sending a employee an email with important criticism represents a problem which communication process
    9·1 answer
  • __ is/are the amount of blank space between lines of text in a paragraph
    7·2 answers
  • Scenes that are shot outside are known as
    9·1 answer
  • Is full dive vr possible and can we accomplish it with today’s technology? Explain why
    13·2 answers
  • What conclusion did Freud reach when attempting to understand the connection between psychological and physical problems?
    12·1 answer
  • Advantages and disadvantages of technology
    13·1 answer
  • George wants to pursue a career in web technology as a web developer. Which certifications can help him as a web developer?
    5·1 answer
  • A business that helps people find jobs for a fee
    12·1 answer
  • Computer is a major source of informarion why​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!