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
Before you can use the Management Studio to work with the objects in a database, you must ___________ the database files (i.e.,
Lelu [443]

Answer:

You must attach the database files

Explanation:

4 0
3 years ago
How can a CRM system help communicate issues in the supply chain between customers and drones?
riadik2000 [5.3K]

Answer:

CRM system can help customers about the service supplied.  

Explanation:

CRM stands for Customer Relationship Management and CRM system is a useful tool for communicating with customers.

CRM can keep the data about the order provided by the customer and has updated info about its status.

For example, if the customer of a logistics company wants to know where his/her order is, customer represantative can give up-to-date info about the order where abouts. Or the customer directly uses web to check the status of the order.

All these service can be provided by a CRM system, since drones can send its location to CRM systems.

8 0
2 years ago
How can you troubleshoot Internet access problems?
joja [24]

Answer:

Check the network icon (or wireless connection settings) to see if you have Internet access. ...

Check for changes to proxy settings.

Check the network cables if your computer is wired to the router.

Reset your router.

Check your firewall or security software.

Hopefully this helps.

8 0
3 years ago
If necessary, create a new project named Advanced19 Project, and save it in the Cpp8\Chap06 folder. Enter (or copy) the instruct
Digiron [165]

Answer:  If a customer orders more than four pizzas, the program should deduct 10% from the cost of the order. Modify the program appropriately, and then save, run, and test it.

4 0
3 years ago
In Microsoft word,when you highlight existing text you want to replace ,you’re in?
Lerok [7]

In Microsoft Word, when you highlight existing text you want to replace, you are in overtype or typeover mode. However, this may also be the case when you are in the Find and Replace tool, where you will type in all the exact phrases or words that will eventually be highlighted and then be replaced in just one click.

5 0
3 years ago
Other questions:
  • Information systems security is the collection of activities that protect the information system and the data stored in it.
    12·1 answer
  • Which of the following represents inbound logistics for a bookstore
    13·1 answer
  • There are ways to perform computer commands quickly and multiple times. <br> a. True <br> b. False
    11·2 answers
  • The domain name service (dns is a distributed database that allows users to communicate with each other computers by:
    7·1 answer
  • You are required to write a calculator for Geometric shapes(Circle, Square, and Rectangle). The basic idea is that you willprovi
    7·1 answer
  • Write a qbasic program to display integer numbers 1 to 100 using the for next loop<br>​
    9·1 answer
  • ¿porque y como surge la informatica y las computadoras
    13·1 answer
  • Pie charts are best used for
    5·1 answer
  • What is one disadvantage people face without a checking account?
    12·1 answer
  • In terms of computer hardware, where does the actual work of computing take place?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!