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
To remove an embedded chart, you should _____ it and press the DELETE key. (Points : 2) move drag hide click
Readme [11.4K]
I think the answer would be "click" 
3 0
2 years ago
How to add a while loop? here's my code
Jet001 [13]

To add while loop in python language, the use of syntax is to be brought into the effect.

<h3>What is a while loop?</h3>

A while loop can be referred to as an expression of code-blocks being true to their cores. Until the blocks of the code are not proved to be true, the loop continues.

In order to add such while loop to your code, one needs to use the syntax function in python to prove the true and correctness of the code blocks.

Hence, the procedure to add while loop has been aforementioned.

Learn more about a while loop here:

brainly.com/question/15690925

#SPJ1

3 0
2 years ago
Write a complete Java program called Rooter that gets a positive integer called "start" from the user at the command line and th
Nataly_w [17]

Answer:

The program in Java is as follows:

import java.util.*;

import java.lang.Math;

public class Rooter{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

 int start;

 System.out.print("Start: ");

 start = input.nextInt();

 while(start<=0){

     System.out.print("Number must be positive\nStart: ");

     start = input.nextInt();  }

 while(start>=0){

     System.out.println(Math.sqrt(start));

     start--;  }

}

}

Explanation:

This declares start as integer

 int start;

This prompts the user for input

 System.out.print("Start: ");

This gets input for start

 start = input.nextInt();

The following is repeated until the user input is valid i.e. positive

<em>  while(start<=0){</em>

<em>      System.out.print("Number must be positive\nStart: ");</em>

<em>      start = input.nextInt();  }</em>

The following while loop prints the square root of each number till 0

<em>  while(start>=0){</em>

<em>      System.out.println(Math.sqrt(start));</em>

<em>      start--;  }</em>

4 0
2 years ago
What are the 3 biggest advancements in computers?
Georgia [21]

Answer:

abacus . Mesopotamia or China, possibly several thousand years BCE. ...

binary math . Pingala, India, 3rd century BCE. ...

punched card . Basile Bouchon, France, 1725. ...

Explanation:

:)

6 0
2 years ago
Which of the following is an example of a complex formula?
myrzilka [38]

Answer:

=A1<=A14

Explanation:

complex formula in excel is which contain more than 1 mathematical operators . An order of mathematical operations are important to understand

there are different type of operators

  • Arithmetic operators
  • Comparison operators
  • Text operators
  • Operators reference

here Comparison operator is an example of complex formula . Comparison operator returns TRUE/FALSE it is use to compare two values

= Equal to

< Less than

> Greater than

>= Greater than or Equal to

<= Less than or Equal to

7 0
3 years ago
Other questions:
  • Which of the following best reflects why lighting systems are used when filming on location outdoors? (Select all that apply.)
    10·1 answer
  • What does a linear bus topology used to connect all network devices?
    8·1 answer
  • If johanna wants to label the x- and y-axes, she should click Layout, then
    8·1 answer
  • How to get the absolute value in coding begginners?
    13·2 answers
  • What is the data and information with example? ​
    9·1 answer
  • Help please!! worth 10 pts! answer quick please!
    12·1 answer
  • 1. Write an if statement that assigns 20 to the variable y, and assigns 40 to the variable z
    10·1 answer
  • Why is John Von Neumann to a remarkable name?<br>si​
    15·1 answer
  • QUICK HELP ME PLEASE
    9·1 answer
  • Tom is not sure how to code contents such as title and meta elements. These are coded as ____ elements.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!