Question: Import account.sql to create the table and insert data in your database. Account.SQL: DROP TABLE IF EXISTS account; create table if not exists account (
Import account.sql to create the table and insert data in your database.
Account.SQL:
DROP TABLE IF EXISTS account;
create table if not exists account
(
account_number char(5) not null primary key,
branch_name varchar(10),
balance double
);
DATA:
insert into account values('A-101', 'Downtown', 500);
insert into account values('A-102', 'Perryridge', 400);
insert into account values('A-201', 'Brighton', 900);
insert into account values('A-215', 'Mianus', 700);
insert into account values('A-217', 'Brighton', 750);
insert into account values('A-222', 'Redwood', 700);
insert into account values('A-305', 'Round Hill', 350);
Writ a MySQL code segment that creates a stored procedure (name the procedure as balance_yourFirstName) that includes SQL statements made as a transaction. The procedure will update an account balance; if there is enough money, it will commit the process; otherwise, it will roll back to its initial state.
Update an account balance (from the account table) for withdrawing an amount; if there is enough money in an account, the procedure will commit else rollback.
Hints: Update for withdrawing money
if the condition is true
update
commit
message transaction is successful.
else
Rollback
message transaction is unsuccessful.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
