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]
4 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]4 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
What is the value of the variable result after these lines of code are executed?
Crank

Answer:

18

Explanation:

If you take the formula, and you substitute the values of the variables, it will be:

    10 * 2 - 10 / 5

Then if you remember the order of math operations, it will be:

    (10 * 2) - (10 / 5)

Which reduces to:

    20 - 2 = 18

4 0
3 years ago
Use the image below to answer this question.
Leviafan [203]

Answer:

The question given is incomplete as it does not contains the image. I have found the image of the question and it is attached below.

The solution of the question is also attached below in the image.

I hope it will help you!

Explanation:

4 0
3 years ago
Which finger is the correct finger to key the letter "O"?
Lorico [155]

Answer:

probably the pincky finger I don't know I use what ever

3 0
3 years ago
Que ventajas podria traer el internet a la educacion artistica? Ayuda porfa telo pido porfavor
lions [1.4K]

Answer:

"Informacion"

Explanation:

La internet puede traer las mismas ventajas para la educacion artistica que cualquier otra materia y eso es "Informacion". El arte tiene muchas tecnicas. Tambien hay muchos differentes estilos de arte. La internet tiene toda la informacion sobre los artistas mas famosos de las historia, incluyendo su arte, tecnicas, estilos, temas, historias, etc. Esta informacion es sumamente importante y util por que te enseña a utilizar todos los metodos ya creados y usarlos como herramientas para crear arte que representa el artista que sos.

8 0
3 years ago
Name all mario kart games in order
Juliette [100K]

Answer:

Super Mario Kart

Mario Kart 64

Mario Kart: Double Dash!!

Mario Kart 7

Mario Kart DS

Mario Kart: Super Circuit

Mario Kart Wii

Mario Kart 8

Mario Kart 8 Deluxe

Mario Kart Live: Home Circuit

Mario Kart

Mario Kart Arcade GP

Mario Kart Arcade GP 2

Mario Kart Tour

Mario Kart Arcade GP DX

Mario Kart Arcade GP VR

Super Mario 64

Super Mario 3D World

─▄████▄▄░

▄▀█▀▐└─┐░░

█▄▐▌▄█▄┘██

└▄▄▄▄▄┘███

██▒█▒███▀

5 0
3 years ago
Read 2 more answers
Other questions:
  • You are in charge of the IT division for a company that has 1,048,576 customers. Your boss asks you to decide between buying a d
    14·1 answer
  • The appropriate length for an e-mail is about half the amount of text that will fit on an 8 1/2' by 11' page.
    11·2 answers
  • What is the real meaning of hack and crack?
    6·1 answer
  • Write a program which reads in a single integer 0 <= n < 30 and prints out the factorial of n. Factorials get very big ver
    9·2 answers
  • A ___ is a node (or a device) that connects two different networks together and allows them to communicate.
    12·1 answer
  • Draw a flowchart to accept two numbers, and then output the result as the first number
    11·1 answer
  • An ____ is a collection of tools, features, and interfaces that enables users to add, update, manage, access, and analyze the co
    10·1 answer
  • Will mark Brainliest!! What is the best hard disk compacity? Why?
    7·1 answer
  • What is a smaller loop statement that can appear on the same line of code?
    10·2 answers
  • which two host names follow the guidelines for naming conventions on cisco ios devices? (choose two.)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!