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
How do you merge on excel?​
neonofarm [45]

First,

Select/Highlight the cells you want to merge

Then,

Go to the <em>Merge and Center </em>button, which should be locate on the toolbar.

Last,

There should be something that says Merge Cells

5 0
3 years ago
WAP to find area of circle​
Tatiana [17]

Answer:

program by LET statement

Explanation:

CLS

REM to find the area of circle

LET r=10

LET a=22/7*2*r^2

PRINT "area=;"a

END  

                                                                                         press f5

output:

a=628.57

7 0
3 years ago
Cell references in a formula are called _____.<br> a. assumptionsc. numbersb. valuesd. content
Airida [17]
It would bbe d because content is what is in something
7 0
3 years ago
11. Describe an algorithm that interchanges the values of the variables x and y, using only assignments. What is the minimum num
Svetlanka [38]

Answer:

Following is the algorithm to interchange the value of two variable x and y.

step 1:Read the two integer x and y.

step 2 :t=x

Step 3: x=y  

step 4: y=t

The minimum number of assignment to do this is 3

Explanation:

After reading two integer x & y, create a variable "t" of integer type.

with the help of variable "t", we can swap the value of variable x and y.

It requires 3 assignment to interchange the value.

6 0
3 years ago
The area of the spreadsheet highlighted in red is the _____.
iragen [17]

A spreadsheet is a software application which is used to display numerical data in a tabular form. It has <em>further functions</em> which includes organizing, displaying, calculating data, etc where the data can be viewed at a glance and retrieved from memory.

There are <em>different types</em> of spreadsheet which includes:

  • <u>G00gle Sheet</u>
  • <u>Microsoft Excel</u>
  • <u>LibreOffice</u>
  • <u>Smartsheet,</u> etc.

Data can be arranged in rows and columns.

Please note that your question is incomplete so I gave you a general overview to help you get a better understanding of the concept.

Read more here:

brainly.com/question/22101774

5 0
2 years ago
Other questions:
  • In Paint, which of the following are ways to use a picture that you have saved on your computer? (Select all that apply.)
    8·1 answer
  • My mac book airs touch pad stopped working and i can't click. what do i do?
    5·2 answers
  • Controlling the physical world with sensors and digital devices depends on bandwidth and the ability to analyze data in real tim
    5·1 answer
  • In 100 words or less, discuss why ethics is especially important for computer professionals, as it pertains to addressing profes
    5·1 answer
  • Irene wants to connect your smart phone wirelessly to her laptop in order to transfer images. which two images could she reasona
    15·1 answer
  • How do you customize calendar view​
    9·2 answers
  • #done with school already
    14·1 answer
  • What is the first phone ever made?
    6·1 answer
  • A ____ is someone who develops programs and apps or writes the instructions that direct the computer or mobile device to process
    8·1 answer
  • Some hackers are skillful computer operators, but others are younger inexperienced people who experienced hackers refer to as?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!